自动安装Google Chrome扩展程序将无法使用! [英] Auto-installing a google chrome extension won't work !

查看:512
本文介绍了自动安装Google Chrome扩展程序将无法使用!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事与此页面有关的工作。 http://code.google.com/chrome/extensions/external_extensions.html


我写了一个试图自动安装Chrome扩展的NSIS脚本。
(为什么?因为我们的扩展可以通过复选框与其他产品安装流程一起提供,那么如果用户选择要添加的扩展,它将使用NSIS静默安装在用户浏览器上自动安装)



我尝试了很多场景,我需要帮助,在谷歌网站上,他们说你可以这样做


  • 使用首选项JSON文件

  • 使用Windows注册表



  • 说:使用首选项文件有一个错误(Windows注意:直到错误41902修复,你可能想使用Windows注册表,而不是首选项文件。)





    提醒:
    An自动安装的扩展名称称为外部扩展名




    • 所以我尝试使用Windows注册表



    要通过注册表添加Google Chrome扩展程序:




    • 添加此项:HKEY_LOCAL_MACHINE \SOFTWARE\Google\Chrome\Extensions(my extension id)

    • 添加路径以.crx的路径
    • 在扩展版本中添加版本


    这是我试过的(使用NSIS脚本):


    • 如果我添加一个注册表键
      它会安装扩展名,但如果用户手动卸载,chrome将打开黑名单标志,并且扩展名不能用任何其他脚本重新安装。剩下的唯一方法是用户手动安装。最糟糕的是,如果用户手动安装并手动卸载(它会关闭黑名单标志),并且当Chrome将重新启动时,它将自动重新安装扩展(无需任何用户操作),因为注册表项仍然存在。


    • 如果我在启动或关闭浏览器时删除注册表项,通过一种奇怪的方式(在crx中使用dll(NPAPI)),chrome会自动删除在浏览器重新启动时扩展目录。

    • 如果我设法在用户卸载扩展时删除注册表项。我们被列入黑名单,所以自动安装程序将不再工作,直到用户通过手动安装和卸载扩展程序关闭黑名单标志。

    • 目录在 C:\ Users \(username)\AppData\Local\Google\Chrome\User Data\Default\Extensions\(extensionID)\(version )_0 \(我的文件在这里) ,我遇到了很多麻烦,因为只要重新启动浏览器,chrome就会删除我的文件。


    有没有人遇到过这个问题,以及需要做些什么。
    我会尝试使用JSON文件,但是直到错误没有解决,注册表才是唯一的方法。



    感谢任何有时间阅读所有内容的人这个 !
    任何帮助将不胜感激,谢谢!

    解决方案

    [ 2013-11-11 ]
    [这个问题的答案即将过时,所以这是一个更新的答案。]






    根据 最近的帖子 在Chromium博客上,自动安装Chrome扩展程序不会在短期内成为一种选择:


    从2014年1月开始,在Windows稳定版和测试版频道上,我们需要在Chrome网上应用店中托管所有扩展程序 作为替代方案,开发人员和供应商可以使用嵌入式安装功能:


    如果您的扩展程序目前在Chrome网上应用店之外托管,则应尽快迁移它们。对您的用户不会有任何影响,他们仍然可以使用您的扩展程序,就像没有任何更改一样。如果您愿意,您可以将扩展程序隐藏在网上商店列表中。如果您在自己的网站上有专门的安装流程,您可以利用现有的内联安装功能。







    因此,基本上,您需要做的是:


    1. 在Chrome网上应用店中托管您的扩展程序optionaly将它从列表中隐藏起来)。

    2. 让您的安装程序打开指向您网站上的网页的Chrome浏览器窗口。

    3. 在该页面上为用户提供所有必要的信息和数据以启动延期的安装过程。 (这里的关键概念是 user 必须通过点击按钮来启动安装过程。



    < hr>

    嵌入式安装如何工作: $ b

    要在其上进行内联安装的网站上的HTML页面必须在引用用户可以安装的项目的部分中包含一个或多个标记,每个标记必须具有以下格式:




     < link rel =chrome-webstore-itemhref =https://chrome.google。 com / webstore / detail / itemID> 




    安装时,必须调用chrome.webstore.install(url,successCallback,failureCallback)函数该函数只能响应用户手势进行调用,例如在点击事件处理程序中;异常如果不是这样,将被抛出。


    (强调我的)



    有关 内嵌安装功能

    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!

    解决方案

    [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:

    Starting in January [2014] on the Windows stable and beta channels, we’ll require all extensions to be hosted in the Chrome Web Store.

    As an alternative, developers and vendors will be able to use the inline installation feature:

    If your extensions are currently hosted outside the Chrome Web Store you should migrate them as soon as possible. There will be no impact to your users, who will still be able to use your extension as if nothing changed. You could keep the extensions hidden from the Web Store listings if you like. And if you have a dedicated installation flow from your own website, you can make use of the existing inline installs feature.


    So, basically, what you need to do is:

    1. Host your extension on the Chrome Web Store (optionaly keeping it hidden from the listings).
    2. Have your installer open a Chrome browser window pointing to a webpage on your site.
    3. On that page have all necessary info and data for the user to initiate the extention's installation process. (The key concept here is that the user has to initiate the installation process, e.g. by clicking a button.


    How does inline installation work:

    The HTML page on your site from which you want inline installation to occur must contain one or more tags in the section referencing the items that the user can install. Each tag must have the following format:

    <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID">
    

    To actually begin inline installation, the chrome.webstore.install(url, successCallback, failureCallback) function must be called. This function can only be called in response to a user gesture, for example within a click event handler; an exception will be thrown if it is not.

    (emphasis mine)

    More info on the inline installs feature.

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

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