Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
6 results across 6 corpora for scripting.executeScript().
Developer library 6
host_permissions
he "tabs" permission, such as the `url`, `title`, and `favIconUrl` properties of tabs.Tab objects. - the ability to inject scripts programmatically (using tabs.executeScript()) into pages served from those origins. - the ability to receive events from the webRequest API for these hosts. - the ability to access cookies for that host using the cookies API, as long as the `"cookies"` API permission is also included. - b
Modify a web page
"eat-page", title: "Eat this page", }); browser.contextMenus.onClicked.addListener((info, tab) => { if (info.menuItemId === "eat-page") { browser.tabs.executeScript({ file: "page-eater.js", }); } }); ``` In this script we're creating a [context menu item](/docs/Mozilla/Add-ons/WebExtensions/API/menus/create), giving it a specific id and title (the text to be displayed in the context menu). Then
Chrome incompatibilities
[`sidePanel` API](https://developer.chrome.com/docs/extensions/reference/api/sidePanel) then enables panels to be manipulated. #### Tabs API When using `tabs.executeScript()` or `tabs.insertCSS()`: - **In Firefox**: Relative URLs passed are resolved relative to the current page URL. - **In Chrome**: Relative URLs are resolved relative to the extension's base URL. To work cross-browser, you can specify the path as
Background scripts
) => { if (message.data === "setAlarm") { browser.alarms.create({ delayInMinutes: 5 }); } else if (message.data === "runLogic") { browser.scripting.executeScript({ target: { tabId: sender.tab.id, frameIds: [sender.frameId], }, files: ["logic.js"], }); } else if (message.data === "changeColor") { browser.scripting.executeScript({ target: { tabId: se
Your second extension
rtError(error); } }); } /** * There was an error executing the script. * Display the popup's error message, and hide the normal UI. */ function reportExecuteScriptError(error) { document.querySelector("#popup-content").classList.add("hidden"); document.querySelector("#error-content").classList.remove("hidden"); console.error(`Failed to execute beastify content script: ${error.message}`); } /** * Whe
Extend the developer tools
(/docs/Mozilla/Add-ons/WebExtensions/API/devtools/inspectedWindow/eval) provides one way to run code in the inspected window. This is somewhat like using tabs.executeScript() to inject a content script, but with one important difference: - unlike content scripts, scripts loaded using `devtools.inspectedWindow.eval()` **do not** get [a "clean view of the DOM"](/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#dom_