Skip to content
WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Initial version Jun 30, 2019
.gitattributes Initial version Jun 30, 2019
.gitignore Initial version Jun 30, 2019
.npmrc Initial version Jun 30, 2019
.travis.yml Initial version Jun 30, 2019
index.ts Safer support detection Jul 1, 2019
license Initial version Jun 30, 2019
package.json 1.0.0 Jun 30, 2019
readme.md Meta fixes Jul 1, 2019
tsconfig.json Initial version Jun 30, 2019

readme.md

content-scripts-register-polyfill

WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.

Travis build status npm version

Install

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');

Usage

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/*'
	]
});

Related

License

MIT © Federico Brigante — Twitter

You can’t perform that action at this time.