docs.rodeo

MDN Web Docs mirror

devtools.inspectedWindow.reload()

{{AddonSidebar}} 

Reloads the window that the devtools are attached to.

Syntax

browser.devtools.inspectedWindow.reload(
  reloadOptions       // object
)

Parameters

Browser compatibility

{{Compat}} 

Examples

Reload the inspected window, setting the user agent and injecting a script:

const reloadButton = document.querySelector("#reload-button");

reloadButton.addEventListener("click", () => {
  browser.devtools.inspectedWindow.reload({
    injectedScript: "alert(navigator.userAgent);",
    userAgent: "Not a real UA",
  });
});

{{WebExtExamples}} 

[!NOTE] This API is based on Chromium’s chrome.devtools API.

In this article

View on MDN