W3cubDocs

/DOM

location.reload

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

This method has an optional Boolean parameter, which is false by default. If true, the page is always reloaded from the server, ignoring the browser cache.

The forcedReload flag changes how some 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.

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

object.reload(forcedReload);

Parameters

forcedReload Optional
A Boolean parameter. If true, the page will always reload from the server. If false or unspecified, the browser may reload the page from its HTTP cache.

Examples

// Reload the current page without the browser cache
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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes Yes Yes Yes Yes
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes Yes Yes Yes Yes

See also

© 2005–2018 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