Install Google Chrome extension from script

google-chrome, google-chrome-extension, javascript

Solution

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

Problem

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)

Original source