Search code examples
google-chrome-extension

Extension is blocked by the administrator. Could not load manifest


I am trying to do something weird here.

I made an extension which works fine but I am trying to prevent the user removing it. It works preventing the removal with extensions from the store but not with mine, which gets removed after I add it in the regedit and if I try to add it again I get that error in the title.

The way I prevent from removing the extension is the following:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist

I add a string, and paste the extension id inside. After I do this, restart chrome, my extension gets removed, while a regular extension just gets it remove button removed.

I gave all possible persmissions to the folder containing the extension, I don't know what to do more, this being first chrome extension I ever done.


Solution

  • Basically, Chrome won't let you to prevent uninstalling a "load unpacked" extension by ExtensionInstallForcelist. It only allows those extensions which are installed by their .crx file along with a private key (ID).

    So, to prevent uninstallation of your self made extension, at first you need to

    • Pack the extension by visiting "chrome://extensions/" in your chrome browser. After turning on developer mode, click on "Pack Extension" and then select the folder which contains your extension by clicking on "Browse" of Extension Root Directory. For Private Key file, leave it blank as it is.

    • After that, a .crx file will be created. Now, drag the .crx file and release it on "chrome://extensions/" page, it'll be added to chrome along with an unique ID.

    • Lastly, copy that ID and go to "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist", add a string, and paste the extension id in "Value data" field, followed by ";https://clients2.google.com/service/update2/crx" (without spaces). Set "Value name" to be 1.

    • Restart chrome, and you'll see that your extension can't be removed.