force browser to clear cache javascript code example
Example 1: javascript empty cache and hard reload
window.history.forward(1);
Example 2: forece reload without clear cache js
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
Example 3: clear cache javascript
Press the button F12
Go to settings and then to the Network:
Now click "Disable Cache (while DevTools are open)"
Then click and hold the mouse button on the reload page and select the last option (Reload site and delete Cache)