从脚本安装Google Chrome扩展程序 [英] Install Google Chrome extension from script

查看:163
本文介绍了从脚本安装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

          这篇关于从脚本安装Google Chrome扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆