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?
You can use the location. reload() JavaScript method to reload the current URL. This method functions similarly to the browser's Refresh button. The reload() method is the main method responsible for page reloading.
The reload() method reloads the current document. The reload() method does the same as the reload button in your browser.
In JavaScript, the reload() method is used to reload a webpage. It is similar to the refresh button of the browser. This method does not return any value.
The location reload() method in HTML DOM is used to reload the current document. This method refreshes the current documents. It is similar to the refresh button in the browser. Syntax: location.reload( forceGet ) Parameters: This method contains single parameter forceGet which is optional.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With