location.reload() method reloads the current URL, like the Refresh button.
The reload may be blocked and a
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
Firefox supports a non-standard
forceGet boolean parameter for
location.reload(), to tell Firefox to bypass its cache and force-reload the current document. However, in all other browsers, any parameter you specify in a
location.reload() call will be ignored and have no effect of any kind.
You may, though, come across instances of
location.reload(true) in existing code that was written with the assumption the force-reload effect occurs in all browsers. A GitHub "
location.reload(true)" search returns several hundred thousand results. So there’s a lot of existing code which has it.
The history of it is: some version of Netscape Navigator added support for it, which apparently eventually got picked up in Firefox. And at one point the W3C Web APIs Working Group took up an issue to consider adding it to the specification for
location.reload(). However, it was never actually added.
So a boolean parameter is not part of the current specification for
location.reload() — and in fact has never been part of any specification for
location.reload() ever published.
|HTML Standard (HTML)|
BCD tables only load in the browser