Reloads the window that the devtools are attached to.
Syntax
browser.devtools.inspectedWindow.reload(
reloadOptions // object
)
Parameters
reloadOptions
Optionalobject
. Options for the function, as follows:-
ignoreCache
Optionalboolean
. If true, this makes the reload ignore the browser cache (as if the user had pressed Shift+Ctrl+R).userAgent
Optionalstring
. 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
Optionalstring
. Inject the given JavaScript expression into all frames in the page, before any other scripts.
Browser compatibility
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
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"
});
});
Acknowledgements
This API is based on Chromium's chrome.devtools
API.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.