从脚本安装Google Chrome扩展程序

问题描述:

我已经创建了 Google-chrome扩展名(crx文件),但是我不想将其上传到 Chrome网上应用店.

I have created my Google-chrome extension (crx file) but I don't want to upload it on Chrome web store.

现在如何在Google chrome中以编程方式(使用JavaScript或chrome API)安装此 crx 文件?

Now how can I install this crx file in Google chrome programmatically (using JavaScript or chrome API) ?

我到处搜索,唯一的解决方案是在chrome网上商店中上传扩展程序,并使用chrome inline_installation.

I have searched all over the place and the only solution was to upload extension on chrome web store and the use chrome inline_installation.

还有其他方法吗? (而且我不希望用户访问我的网站并单击安装"按钮时要安装预安装的扩展程序)

Is there any other way ? (and I don't want pre-installed-extensions I want to install when user visits my site and click on install button)

此处 此处 是托管的说明您自己的服务器上的可安装.crx文件. 基本上:

Here and here are instructions to hosting an installable .crx file on your own server. Basically:

如果满足以下任一条件,则Google Chrome认为文件是可安装的:

Google Chrome considers a file to be installable if either of the following is true:

  • 文件的内容类型为application/x-chrome-extension
  • 文件后缀为.crx,并且以下两个条件都为真:
    • 该文件不带有HTTP标头X-Content-Type-Options:nosniff
    • 该文件具有以下内容类型之一:
      • 空字符串
      • 文字/纯文字"
      • 应用程序/八位字节流"
      • 未知/未知"
      • 应用程序/未知"
      • "*/*"
      • The file has the content type application/x-chrome-extension
      • The file suffix is .crx and both of the following are true:
        • The file is not served with the HTTP header X-Content-Type-Options: nosniff
        • The file is served with one of the following content types:
          • empty string
          • "text/plain"
          • "application/octet-stream"
          • "unknown/unknown"
          • "application/unknown"
          • "*/*"

          更新
          Chrome不再允许从应用商店外部自动安装扩展程序.用户必须下载.crx文件,将扩展名拖到chrome://extensions页面.
          来源

          UPDATE
          Chrome no longer allows extensions to be automatically installed from outside the app store. The user must download the .crx file drag the extension to the chrome://extensions page.
          Source