English 中文(简体)
如何主持铬扩展名?
原标题:How to host a chrome extension?

我需要在与PHP共享的主机上 主办我的铬扩展

我知道我的服务器必须使用适当的 HTTP 信头 : < a href="http://code.google.com/chrome/extensions/hosting.html" rel="noreferr" >code.google.com/chrome/extensions/hosting.html

但是,如何设置我的服务器 发送这些信头 上瘾到. crx文件?

最佳回答

如果您在一个共享的主机上, 无法更改服务器配置, 请使用 PHP:

<?php
$file =  extension.crx ;

if (file_exists($file)) {
    header( Content-Description: File Transfer );
    header( Content-Type: application/x-chrome-extension );
    header( Content-Disposition: attachment; filename= .basename($file));
    header( Content-Transfer-Encoding: binary );
    header( Expires: 0 );
    header( Cache-Control: must-revalidate );
    header( Pragma: public );
    header( Content-Length:   . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>

>来源

这将强制下载文件( 由 $file file 变量指定), 由自定义信头下载 。

问题回答

我不知道你在使用什么网络服务器,但对于阿帕奇来说,你可以做以下工作:

  1. vi /path/to/your/httpd/conf/mime.types
  2. Add this line: application/x-chrome-extension crx at the end of the file
  3. Restart your webserver: killall -HUP httpd

或者您可以尝试将此行添加到您的 .ht access 文件 :

AddType application/x-chrome-extension crx

并且应该有效!





相关问题
Redirect to cache URL in Chrome browser

self.location = cache: + self.location I want to redirect from "[URL]" to "cache:[URL]". I just want this code to work in Chrome browser.

我如何更新/重载 Chrome延?

I m在4号 Chrome(目前为4.0.249.0)中开发一个延伸点,显示用户在地位酒吧中的形象。 Ive设计了一个供用户使用的备选办法网页......

Setting Opacity in CSS For Chrome

I ve tried the following: (this is actually for fancybox, as the overlay does not show in chrome/safari: $("#fancy_overlay").css({<br /> background-color : opts....

Chrome Blocking Javascript, Google Wave, Google Gadgets

Project: Developing a gadget template for Google Wave which will allow my Flash movies to interact with the Wave api. I had to adapt the existing Flex application so that it would work with ...

image height using jquery in chrome problem

$( img ).height() returns 0 in chrome, but it returns the actual height in IE and firefox. Whats the actual method to get the height of the image in chrome?

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Table cells bad rendering with Google Chrome/Webkit

On the following code, COL1A and COL3A are not 50% height with Chrome or Webkit. It works fine with IE7 and Firefox. <table border="1"> <tr> <td height="100%">COL 1A</td>...

热门标签