devtools.inspectedWindow.reload()
{{AddonSidebar}}
Reloads the window that the devtools are attached to.
Syntax
browser.devtools.inspectedWindow.reload(
reloadOptions // object
)
Parameters
-
reloadOptions
{{optional_inline}}
-
:
object
. Options for the function, as follows:ignoreCache
{{optional_inline}}
- :
boolean
. If true, this makes the reload ignore the browser cache (as if the user had pressed Shift+Ctrl+R).
- :
userAgent
{{optional_inline}}
- :
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 tonavigator.userAgent
made by scripts running in the page.
- :
injectedScript
{{optional_inline}}
- :
string
. Inject the given JavaScript expression into all frames in the page, before any other scripts.
- :
-
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.