自动安装 google chrome 扩展程序不起作用!
我正在从事与此页面相关的工作
我编写了一个 NSIS 脚本,尝试自动安装 chrome 扩展。 (为什么?因为我们的扩展可以通过复选框与另一个产品安装流程一起提供,那么如果用户选择要添加我们的扩展,它将使用 NSIS 静默安装自动安装在用户 chrome 浏览器上)
我尝试了很多场景并且我需要帮助,在谷歌网站上,他们说你可以这样做
- 使用首选项 JSON 文件
- 使用 Windows 注册表
他们还说“使用首选项文件”有一个错误(Windows 注意:在错误 41902 修复之前,你可能想要使用 Windows 注册表而不是首选项文件。)
提醒: 自动安装的扩展被称为外部扩展
- 所以我尝试“使用 Windows 注册表”
要通过注册表添加 google chrome 扩展:
- 添加此键:“HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions(我的扩展 id)”
- 添加“路径”与 .crx 的路径
- 添加“版本”与扩展版本
这是我尝试过的(使用 NSIS 脚本):
如果我添加注册表项 它将安装扩展程序,但如果用户手动卸载,chrome 会打开黑名单标志,并且无法使用任何其他脚本重新安装扩展程序。剩下的唯一方法是用户手动安装。最糟糕的是,如果用户手动安装并手动卸载(它将关闭黑名单标志),并且当 chrome 重新启动时,它将自动重新安装扩展(无需任何用户操作),因为注册表项仍然存在。
- 我在启动或关闭浏览器时通过一种奇怪的方式(使用 crx 中的 dll(NPAPI))删除注册表项,则 Chrome 会在浏览器重新启动时自动删除扩展目录。
如果我在用户卸载扩展时设法删除注册表项。我们被列入黑名单,因此自动安装程序将不再工作,直到用户通过手动安装和卸载扩展来关闭黑名单标志。
如果我在“C:\Users\(用户名)\AppData\Local\Google\Chrome\User Data\Default\Extensions\(extensionID)\(version)_0\(”中创建目录我的文件在这里)”,我遇到了很多麻烦,因为 chrome 会在重新启动浏览器后立即删除我的文件。
有没有人遇到过这个问题,需要做什么。 我将尝试使用 JSON 文件,但在错误未修复之前,注册表是唯一的方法。
感谢所有有时间阅读这一切的人! 任何帮助将不胜感激,谢谢!
I am working on a job in relation with this page
I wrote a NSIS script that is trying to auto install a chrome extensions.
(Why ? because our extension can be offered with another product installation flow through a checkbox, then if user select our extension to be added, it will auto-install on the user chrome browser using NSIS silent installation)
I tried a lot of scenario and I need help, on google website, they say you can do this
- Using a preferences JSON file
- Using the Windows registry
They also say that "Using a preferences file" has a bug (Windows note: Until bug 41902 is fixed, you might want to use the Windows registry instead of the preferences file.)
Reminder:
An extension that's installed automatically is known as an external extension
- So I tried "Using the Windows registry"
To add a google chrome extensions through registry:
- add this key: "HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions(my extension id)"
- add "path" with the path to a .crx
- add "version" with the version of the extension
This is what I tried (using NSIS script):
If I Add a registry key
It will install the extension, BUT if user uninstall manually, chrome turns the blacklist flag on and the extension can't be reinstalled with any other script. The only way left is that user installs, manually. Worst, if user install manually and uninstall manually (it will turn the blacklist flag off), and when chrome will be restarted, it will reinstall the extensions automatically (without any user action) since the registry key is still there.If I remove the registry key when we start or close the browser, through a freaky way (using a dll(NPAPI) within the crx), chrome will auto-delete the extensions directory when browser restarts.
If I manage to delete the registry key when user uninstall the extension. We get blacklisted, so the auto-installer won't work anymore until user turn blacklist flag off by manually installing&uninstalling the extension.
If I create the directory in "C:\Users\(username)\AppData\Local\Google\Chrome\User Data\Default\Extensions\(extensionID)\(version)_0\(my files here)", I run into a lot of trouble because chrome will delete my files as soon as it restarts the browser.
Does anyone have run into this problem, and what has to be done.
I will try with the JSON file but until bug isn't fixed, Registry is the only way.
Thank for anyone who had the time to read all this !
Any help will be appreciated, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
[2013-11-11]
[这个问题的答案即将过时,所以这里有一个更新的答案。]
根据 Chromium 博客上的最新帖子,在不久的将来,自动安装 Chrome 扩展程序将不再是一个选项:
作为替代方案,开发人员和供应商将能够使用内联安装功能:
因此,基本上,您需要做的是:
内联安装如何工作:
(强调我的)
有关内联安装功能<的详细信息/强>。
[2013-11-11]
[The answers to this question are about to become outdated, so here is a more up-to-date answer.]
According to a recent post on the Chromium Blog, auto-installing a Chrome Extension won't be an option in the near future:
As an alternative, developers and vendors will be able to use the inline installation feature:
So, basically, what you need to do is:
How does inline installation work:
(emphasis mine)
More info on the inline installs feature.
有一种更简单的方法...单击该复选框后,从
后台页面
运行此代码:您要安装的预期扩展(.crx 文件)可以托管在网络上,也可以托管在可以位于您的原始扩展文件夹中...您将需要
manifest
中的tabs
权限There is an easier way... When the checkbox is clicked, run this code from the
background page
:The intended extension you want to install, (.crx file) can either be hosted on the net or can be inside your original extension folder... You will need
tabs
permission in yourmanifest
另请参阅完整的博客文章
also see full blog post