How to Reload the Page in JavaScript

What are some ways to do this that are supported across browsers?

Generic Solution


The false will serve the page from cache. If we set it true, then we’ll reload an entirely fresh copy of the page from the server (similar to a force refresh).

After an onclick Event

If we are refreshing after an onclick event, we’ll need to return false afterwards.

return false;

After a POST

If we want to reload the page after submitting a method="post" form, then we have two options.

We can keep the POST data using the same solution as above.


Or we can discard the POST data.

window.location.href = window.location.href;