r.bhardwaj
r.bhardwaj

Reputation: 1613

Install Google Chrome extension from script

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

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

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)

Upvotes: 7

Views: 17786

Answers (2)

Brian
Brian

Reputation: 4344

There is a simple way to install locally-hosted Chrome extensions for personal use. I use this method for my own authoring, testing, and use on my machine.

If it is just an extension, you can put all of your files (background, manifest, etc) into a directory on your computer. Then, open Chrome and do the following:

  1. Navigate to chrome:extensions in the omnibar.
  2. Make sure the Developer Mode box is checked
  3. Click on "Load unpacked extension
  4. In the file browser, navigate to your directory and click Open

Chrome will install the extension to your machine. No need for the .crx file. To distribute this to colleagues, you could host the file for download in Dropbox or your Drive account. They would need to follow the same process to install the extension on their machine.

Do note that if you make updates to the extension for stability or other compatibility upgrades, each person with the extension will need to download the updated directory and then update the extension manually.

Upvotes: 1

makenova
makenova

Reputation: 3645

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

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

  • 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"
      • "*/*"

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

Upvotes: 4

Related Questions