tags:

views:

298

answers:

1

In Javascript how can I force the web browser to do a hard refresh of the page? i.e., get a fresh copy of the page AND refresh all the external resources (images, javascript, css, etc.)

+6  A: 

Try to use:

location.reload(true);

When this method receives a true value as argument, it will cause the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

More info:

CMS
ahh you beat me to it!
Codygman
I am pretty sure this won't reload all external resources. You would have to read through all the `a`, `link`, `script` and `img` elements and append a random query string to the end of each external reference *after* the hard reload. Or, do that on the server.
Doug Neiner