The Location.reload()
method reloads the resource from the current URL. Its optional unique parameter is a Boolean
, which, when it is true
, causes the page to always be reloaded from the server. If it is false
or not specified, the browser may reload the page from its cache. Besides caching behaviour forcedReload
flag also impacts how some browsers handle scroll position: ordinary reload happens to try to restore scroll position after reloading page DOM, while in forced mode (when parameter is set to true
) the new DOM gets loaded with scrollTop == 0
.
If the assignment can't happen because of a security violation, a DOMException
of type SECURITY_ERROR
is thrown. This happens if the origin of the script calling the method is different from the origin of the page originally described by the Location
object, usually when the script is hosted on a different domain.
object.reload(forcedReload);
Boolean
flag, which, when it is true
, causes the page to always be reloaded from the server. If it is false
or not specified, the browser may reload the page from its cache.// Reload the current page, without using the cache window.location.reload(true);
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'Location.reload()' in that specification. | Living Standard | No change from HTML5. |
HTML5 The definition of 'Location.reload()' in that specification. | Recommendation | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Location
interface it belongs to.Location.assign()
and Location.replace()
.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/location/reload