Location.reload()

The Location.reload() method reloads the current URL, like the Refresh button.

In some browsers, this method has an optional Boolean parameter, which is false by default. If true, the page is always reloaded from the server, bypassing the browser HTTP cache.

The reload may be blocked and a SECURITY_ERROR DOMException thrown. This happens if the origin of the script calling location.reload() differs from the origin of the page that owns the Location object. See Same-origin policy for more information.

Syntax

location.reload(forcedReload);

Parameters

forcedReload Optional

A Boolean to indicate that the page will always reload from the server. If false or unspecified, the browser may reload the page from its HTTP cache.

The forcedReload flag changes how Mozilla browsers handle the user's scroll position. Usually reload() restores the scroll position afterward, but forced mode can scroll back to the top of the page, as if window.scrollY === 0.

Example

// Reload the current page without the browser 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 AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
reloadChrome Full support YesEdge Full support 12
Notes
Full support 12
Notes
Notes If a page added to Trusted Sites contains a cross-origin iframe, then calling reload() from within the iframe reloads the trusted page (in other words, the top page reloads, not the iframe).
Firefox Full support YesIE Full support Yes
Notes
Full support Yes
Notes
Notes If a page added to Trusted Sites contains a cross-origin iframe, then calling reload() from within the iframe reloads the trusted page (in other words, the top page reloads, not the iframe).
Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android 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 implementation notes.
See implementation notes.

See also