devtools.inspectedWindow.reload()

Reloads the window that the devtools are attached to.

Syntax

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

Parameters

reloadOptions Optional

object. Options for the function, as follows:

ignoreCache Optional

boolean. If true, this makes the reload ignore the browser cache (as if the user had pressed Shift+Ctrl+R).

userAgent Optional

string. Set a custom user agent for the page. The string supplied here will be sent in the browser's User-Agent header, and will be returned by calls to navigator.userAgent made by scripts running in the page.

injectedScript Optional

string. Inject the given JavaScript expression into all frames in the page, before any other scripts.

Examples

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

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

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
reload
Chrome – Full support
Chrome 18 (Release date: 2012-03-28)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 54 (Release date: 2017-06-13)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Note: This API is based on Chromium's chrome.devtools API.