published: 19 May 2022
2 min read
How to reload the current page with JavaScript
In JavaScript, the reload()
method of the Location
object is used to reload the current web page.
Here is an example:
location.reload();
You can also pass an optional boolean parameter to reload()
to force the browser to reload the page from the server:
location.reload(true);
If you pass the false
value or skip it entirely, the browser may reload the page from its cache.
Take a look at JavaScript location object tutorial to learn more about the Location
object properties and methods.
Are we missing something? Help us improve this article. Reach out to us.
How to reload the current page with JavaScript
In JavaScript, the reload()
method of the Location
object is used to reload the current web page.
Here is an example:
location.reload();
You can also pass an optional boolean parameter to reload()
to force the browser to reload the page from the server:
location.reload(true);
If you pass the false
value or skip it entirely, the browser may reload the page from its cache.
Take a look at JavaScript location object tutorial to learn more about the Location
object properties and methods.
Are you looking for other code tips?
JS Nooby
Javascript connoisseur