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 the forcedReload flag also impacts how some browsers handle the scroll position: ordinary reload tries to restore the scroll position after reloading the page, 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.

Syntax

object.reload(forcedReload);

Parameters

forcedReload Optional
Is a 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.

Examples

// Reload the current page, without using the cache
window.location.reload(true);

Specifications

Specification Status Comment
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.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

See also

Document Tags and Contributors

Last updated by: fscholz,