// Register two content scripts.
await browser.scripting.registerContentScripts([
{
id: "script-1",
js: ["script-1.js"],
matches: ["*://example.com/*"],
},
{
id: "script-2",
js: ["script-2.js"],
matches: ["*://example.com/*"],
},
]);
// Retrieve all content scripts.
let scripts = await browser.scripting.getRegisteredContentScripts();
console.log(scripts.map((script) => script.id)); // ["script-1", "script-2"]
// Only retrieve the second script.
scripts = await browser.scripting.getRegisteredContentScripts({
ids: ["script-2"],
});
console.log(scripts.map((script) => script.id)); // ["script-2"]scripting.getRegisteredContentScripts() / notebook
scripting.getRegisteredContentScripts()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.