Skip to content

Instantly share code, notes, and snippets.

@jerinisready
Last active June 21, 2019 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerinisready/c4cc1547c45989c18a97b581f9b500c6 to your computer and use it in GitHub Desktop.
Save jerinisready/c4cc1547c45989c18a97b581f9b500c6 to your computer and use it in GitHub Desktop.
Reload page if a browser-cached version is loaded! ie; via back or forward buttons... https://stackoverflow.com/a/43043658/6419332
<script>
/** Credits: https://stackoverflow.com/a/43043658/6419332 */
window.addEventListener( "pageshow", function ( event ) {
var historyTraversal = event.persisted ||( typeof window.performance != "undefined" &&
window.performance.navigation.type === 2 );
if ( historyTraversal ) {window.location.reload();}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment