GO-V.ORG
As seen in

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 devtools.inspectedWindow.eval().

Developer library 6

Extend the developer tools

- The same [WebExtension APIs as in Content Scripts](/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis) - The devtools APIs: - [`devtools.inspectedWindow`](/docs/Mozilla/Add-ons/WebExtensions/API/devtools/inspectedWindow) - [`devtools.network`](/docs/Mozilla/Add-ons/WebExtensions/API/devtools/network) - [`devtools.panels`](/docs/Mozilla/Add-ons/WebExtensions/API/devtools/panels) Note that t

devtools panels

n.addListener(handleShown); newPanel.onHidden.addListener(handleHidden); }); ``` The extension can now run code in the inspected window using [`devtools.inspectedWindow.eval()`](/docs/Mozilla/Add-ons/WebExtensions/API/devtools/inspectedWindow/eval) or by injecting a content script via the background script by passing a message. You can find more details on how to do this in [Extending the developer tools.](/do

devtools.inspectedWindow

ease see [Limitations of the devtools APIs](/docs/Mozilla/Add-ons/WebExtensions/Extending_the_developer_tools#limitations_of_the_devtools_apis). The `devtools.inspectedWindow` API lets a devtools extension interact with the window that the developer tools are attached to. Like all the `devtools` APIs, this API is only available to code running in the document defined in the [devtools_page](/docs/Mozilla/Add-ons/Web

devtools.inspectedWindow.eval()

s Inspector, otherwise it creates an object preview in the console. [See some examples.](#examples) ## Syntax ```js-nolint let evaluating = browser.devtools.inspectedWindow.eval( expression, // string options // object ) ``` ### Parameters - `expression` - : `string`. The JavaScript expression to evaluate. The string must evaluate to an object that can be represented as JSON, or an exceptio

onSelectionChanged

ples Listen for selection changed events, and log the text content of the newly selected element: ```js function handleSelectedElement() { browser.devtools.inspectedWindow.eval("$0.textContent").then((result) => { console.log(result[0]); }); } browser.devtools.panels.elements.onSelectionChanged.addListener( handleSelectedElement, ); ``` ## Browser compatibility > [!NOTE] > This API is based on Chro

devtools.panels.ElementsPanel.setExpression()

sion in the context of the inspected page, and displays the result in the extension sidebar pane. The expression's execution context is the same as that for [`inspectedWindow.eval()`](/docs/Mozilla/Add-ons/WebExtensions/API/devtools/inspectedWindow/eval). JSON objects and DOM nodes are displayed as an expandable tree, as in the [JSON viewer](https://firefox-source-docs.mozilla.org/devtools-user/json_viewer/index.ht

JSON results · Services directory