Build Chrome extensions quicker with a TypeScript boilerplate project

chrome.scripting.registerContentScript is still not implemented in Chrome

ExtensionNinja | 2/22/2021

I will admit, I have lost a few hours of my day digging through extension manifest v3 documentation trying to figure out how to make the new chrome.scripting.registerContentScript API work. Then I finally noticed a small note that this API is not supported yet. (╯°□°)╯︵ ┻━┻

In fact, most of the Chrome extension documentation is in between v2 and v3 manifest versions and makes it very hard to follow. I don’t understand why Google is pushing developers to update to manifest v3 while their own developer content is not ready and some of the replacement APIs are not implemented.

What’s so special about chrome.scripting.registerContentScript?

chrome.scripting.registerContentScript creates a new option to dynamically register a content script for a given origin. This allows to create a flow where users are asked to approve extension access to a domain when users trigger an action in the extension. Optional permissions give more control to the user and let’s extension developers explain why the permission is needed. Instead of leaving it up to the user to figure out why specific permissions are needed when installing the extension.

An example of how the new API would allow to dynamically request scripting permission and then register content script for a new domain at runtime.

        permissions: ['scripting'],
        origins: ['*']
    }, (granted) => {
        if (granted) {
                matches: ['*'],
                js: ['content.js'],
                css: ['style.css'],

Chrome extension v3 manifest future

I am positive about v3 manifest and see it as a welcome evolution of Chrome extension platform in the light of recent privacy and security incidents. I have just hoped that the transition would be better managed.

I am looking forward to when registerContentScript is implemented and I can remove wildcard content script permissions from my extension.

You can follow registerContentScript implementation progress on Chrome Bugs website.

Don't miss latest Chrome extension developer news

Join Newsletter