JavaScript Reload Page – How to Reload a Page Using JavaScript

javascript

In order to reload the page without fully reloading everything I'm using:

window.top.location=window.top.location;

However, this doesn't work for some reason when there is anchor text. It appears to do nothing in this case, but more likely it refreshes the anchor.

Any fix for this that will reload the page (as above) without reloading the cached images and scripts?

Best Answer

Try using location.reload(false).

As MDN says, the second parameter is a boolean indicating whether to bypass the cache or not. false keeps using the cache, as you wanted.

Related Question