Skip to content

Aqa-Ib/content-scripts-register-polyfill

 
 

Repository files navigation

content-scripts-register-polyfill

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

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%