Use the browser.devtools.inspectedWindow API to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.

Allowed in: Devtools pages only

_EvalOptions
_EvalReturnExceptionInfo
_ReloadReloadOptions
Resource
onResourceAdded
onResourceContentCommitted
tabId
eval
getResources
reload
onResourceAdded: WebExtEvent<(resource: Resource) => void> | undefined

Fired when a new resource is added to the inspected page.

Unsupported on Firefox at this time.

onResourceContentCommitted:
    | WebExtEvent<(resource: Resource, content: string) => void>
    | undefined

Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools).

New content of the resource.

Unsupported on Firefox at this time.

tabId: number

The ID of the tab being inspected. This ID may be used with browser.tabs.* API.

  • Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.

    Parameters

    • expression: string

      An expression to evaluate.

    • Optionaloptions: _EvalOptions

      The options parameter can contain one or more options.

    Returns Promise<object>

  • Retrieves the list of resources from the inspected page.

    Returns Promise<Resource[]>

    Unsupported on Firefox at this time.

  • Reloads the inspected page.

    Parameters

    Returns void