Reloads the window that the devtools are attached to.
devtools.inspectedWindow.reload()
Syntax
browser.devtools.inspectedWindow.reload( reloadOptions // object )
Parameters
-
reloadOptionsOptional -
object. Options for the function, as follows:-
ignoreCacheOptional -
boolean. If true, this makes the reload ignore the browser cache (as if the user had pressed Shift+Ctrl+R). -
userAgentOptional -
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.userAgentmade by scripts running in the page. -
injectedScriptOptional -
string. Inject the given JavaScript expression into all frames in the page, before any other scripts.
-
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
reload |
Yes | 79 | 54 | ? | Yes | 16 | ? | ? | No | ? | No | ? |
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" }); });
Note: This API is based on Chromium's chrome.devtools API.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools/inspectedWindow/reload