0

Is there a way to have the button do a hard refresh rather than a normal one? Usually users would hold ctrl and press the refresh page in chrome.

I have the following script:

const reloadtButton = document.querySelector("#reload");
// Reload everything:
function reload() {
    reload = location.reload();
}
// Event listeners for reload
reloadButton.addEventListener("click", reload, false);

html:

<button onClick="window.location.reload();">Refresh Page</button>
  • 3
    If you want to serve fresh files, you should be setting the headers to expire the cache or not cache the resource at all. – VLAZ May 11 '21 at 04:53
  • Does this answer your question? [How to force the browser to reload cached CSS and JavaScript files](https://stackoverflow.com/questions/118884/how-to-force-the-browser-to-reload-cached-css-and-javascript-files) – Abhishek Pandey May 11 '21 at 05:07

0 Answers0