Build Chrome extensions quicker with a TypeScript boilerplate project
Download

Solved: The extensions gallery cannot be scripted

ExtensionNinja | 6/17/2022

“Error: The extensions gallery cannot be scripted.” is thrown when the extension is trying to run chrome.scripting.executeScript on the Chrome Web Store. On Edge browser the same happens both for the Chrome Web Store and Edge Add-ons store. The primary reason for this is security and web page tampering prevention.

Imagine if you could run executeScript on the Chrome Web Store. You could create an extension that secretly changes ratings of all your competitor extensions. Even worse, what if you could find a way to trigger extension installation without the user's action?

Downside of this limitation is that you need to handle this special case. It's quite common for users to immediately activate the extension after installation while still being on the Chrome Web Store. Nothing will be shown if your extension relies on injecting scripts to show UI on the page. You need to think how to communicate to the user that they should try a different page. Otherwise, some number of potential users will immediately uninstall your extension thinking that it does not work.

Note: Content scripts declared in the Manifest are loaded on Chrome Web Store. But Chrome runs it in a proxy.html page that limits what the declarative content scripts can do. For example, querying the DOM does not return any results because the proxy page is an empty HTML document.

Don't miss latest Chrome extension developer news

Join Newsletter