How to install a Chrome extension programmatically?
Asked Answered
H

4

20

I've written an extension for Google Chrome that will be released with the next version of our product. I want to understand what properties, paths for extraction, registry entries, etc. should I provide the installer of my product so that the end user doesn't have to install the extension on their own manually, and the installer does the complete job of installing the extension, and also notifies the user that the extension has been installed. As of now, the code that I have written is placed in a folder, and I use the "Load Unpackaged Extension" to load the extension. What should I do to achieve the aforementioned task?

Hotze answered 18/4, 2012 at 14:39 Comment(0)
C
7

Chrome has a couple ways of installing extensions programmatically: http://www.chromium.org/administrators/pre-installed-extensions

Edit: yes, this policy has changed by now, as FuzzyAmi points out.

Conditional answered 21/4, 2012 at 22:29 Comment(3)
This link should no longer be used. Refer to my Answer for the currently-correct answer.Club
@Club do you have any source stating that the info on that link is no longer valid? I can read "For Windows instances that are not joined to a Microsoft Active Directory domain, forced installation is limited to apps and extensions listed in the Chrome Web Store." So it looks like it's actually possible for Windows Server machines?Percentage
@Percentage - apologies, I no longer dabble with this kind of thing.Club
C
17

Google's current policy on installing extensions via the registry (for Windows machines) is this: Only extensions from the Google Extension Gallery (or Chrome Web Store - CWS) can be installed via the registry.

See this link - https://developer.chrome.com/extensions/external_extensions - for information on how this can be done. Keep in mind the following:

-This technique will still pop-up a msgbox to the user. its not completely silent.

-When using this technique, if the user subsequently removes the extension from her Chrome, the extension gets "blacklisted" on that chrome and will not re-auto-install until the user re-install it manually. refer to Auto-installing a google chrome extension won't work ! for details.

Club answered 27/5, 2014 at 8:41 Comment(2)
It works great from an installer if a user has rights to HKLM, but if he does not, this does not work at all.Drice
From developer.chrome.com/apps/external_extensions: "Both ways support installing an extension hosted at an update_URL. On Windows and Mac, the update_URL must point to the Chrome Web Store where the extension must be hosted.". So it looks like it's possible only on Linux if the extension is not hosted on Chrome Web Store.Percentage
C
7

Chrome has a couple ways of installing extensions programmatically: http://www.chromium.org/administrators/pre-installed-extensions

Edit: yes, this policy has changed by now, as FuzzyAmi points out.

Conditional answered 21/4, 2012 at 22:29 Comment(3)
This link should no longer be used. Refer to my Answer for the currently-correct answer.Club
@Club do you have any source stating that the info on that link is no longer valid? I can read "For Windows instances that are not joined to a Microsoft Active Directory domain, forced installation is limited to apps and extensions listed in the Chrome Web Store." So it looks like it's actually possible for Windows Server machines?Percentage
@Percentage - apologies, I no longer dabble with this kind of thing.Club
C
1

If you're using GNU/Linux, this is how you pre-install an extension from the chrome web store for all users:

/etc/chromium/policies/managed/yourextension_policy.json
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
{
    "ExtensionInstallForcelist": [
        "yourextensionuniqueidentifiersup;https://clients2.google.com/service/update2/crx",
        "yourextensionuniqueidentifiersup"
    ]
}

Reference

metamask-chrome - AUR

Cartload answered 30/11, 2021 at 23:6 Comment(1)
Is this officially documented anywhere by Google?Kikuyu
T
1

Windows

I'm using Dark Reader for this example.

Local crx

Create a registry key with extension id and two properties within: path with string value of full path to to the crx file and version with string value of the version of the extension.

x64

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\eimadpbcbfnmbkopoojfekhnkhdbieeh]
"path"="C:\\Users\\admin\\Desktop\\Dark-Reader.crx"
"version"="4.9.83"

x32

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions\eimadpbcbfnmbkopoojfekhnkhdbieeh]
"path"="C:\\Users\\admin\\Desktop\\Dark-Reader.crx"
"version"="4.9.83"

Web Store

Create a registry key with extension id and update_url property within with the string value of the update url

x64

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\eimadpbcbfnmbkopoojfekhnkhdbieeh]
"update_url"="https://clients2.google.com/service/update2/crx"

x32

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions\eimadpbcbfnmbkopoojfekhnkhdbieeh]
"update_url"="https://clients2.google.com/service/update2/crx"

The current relevant docs for this problem are https://developer.chrome.com/docs/extensions/how-to/distribute/install-extensions and https://www.chromium.org/administrators/pre-installed-extensions/

Terzetto answered 22/4 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.