Reputation: 357
Is it possible to install a chrome extension programmatically? My setup application (in Windows) is a batch file which adds a registry key to enable executing a native app. That app talks to a chrome extension and the extension needs to be installed, too.
I already know that there are three major standard ways to install a chrome extension, namely, chrome web store, inline and custom installation (preference and windows registry). All of these techniques leave extra steps for the user to install the native app itself. Also, the last technique is not possible in Windows and latest Chrome versions if someone wants to host the .crx package somewhere else than the chrome web store.
My goal: For a simple one step installation I need to install the chrome extension and the app all in one batch file. Of course it is OK for me to write an application to install the chrome extension and add it there in the batch file. But is it really impossible to write such a program? I want to avoid extra user interaction for installing the extension e.g. dragging and dropping the extension to get it installed.
Kindly provide an answer if you are familiar with this subject and you have personal experience. I highly appreciate that.
PS. I have seen such a question already here, but actually the comments and answers have ended up off topic ultimately.
Upvotes: 4
Views: 1042
Reputation: 1553
You can install a chrome extension programmatically, but you have to publish it via the chrome store to do so. You can publish the extension as unlisted, meaning it won't show up in search, but it has to be in the chrome store to do so.
The reason Google does this is so they can run malware/virus checks on the extensions to prevent malicious installation of them. To clarify from your question, it is impossible to programmatically install an extension that's not published to the chrome web store.
Documentation for this is available here for Windows: https://developer.chrome.com/extensions/external_extensions#registry
There are alternative methods on that same page for Mac/Linux as well.
Essentially, what you'll do is add a registry key that links to your extension in the web store, and handles updating/etc. This will not require any user interaction, so I think it should work for your purposes.
Upvotes: 4