WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.
You can just download the standalone bundle (it might take a minute to download) and include the file in your manifest.json
, or:
npm install content-scripts-register-polyfill
import 'content-scripts-register-polyfill';
require('content-scripts-register-polyfill');
Include the script via manifest.json
, then refer to the original contentScripts.register()
documentation.
const registeredScript = await chrome.contentScripts.register({
js: [{
file: 'myfile.js'
}],
matches: [
'https://google.com/*'
]
});
Additionally, if you're using webextension-polyfill, you can also use it with the original browser.*
name: browser.contentsScripts.register()
const registeredScript = await browser.contentScripts.register({
js: [{
file: 'myfile.js'
}],
matches: [
'https://google.com/*'
]
});
- webext-options-sync - Helps you manage and autosave your extension's options.
- webext-domain-permission-toggle - Browser-action context menu to request permission for the current tab.
- webext-dynamic-content-scripts - Automatically inject your
content_scripts
on custom domains. - webext-detect-page - Detects where the current browser extension code is being run.
- webext-content-script-ping - One-file interface to detect whether your content script have loaded.
Awesome WebExtensions
: A curated list of awesome resources for Web Extensions development.
MIT © Federico Brigante