// Valid registration:
await browser.userScripts.register([
{
worldId: "myScriptId",
js: [{ code: "console.log('Hello world!');" }],
matches: ["*://example.com/*"],
},
]);
// Invalid! Would result in script without matches or includeGlobs!
await browser.userScripts.update([{ matches: [] }]);
// Valid: replaces matches with includeGlobs.
await browser.userScripts.update([
{
matches: [],
includeGlobs: ["*example*"],
},
]);userScripts.update() / notebook
userScripts.update()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.