Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vm6ej04/40ee7c328193425cf281b2f64b409a20 to your computer and use it in GitHub Desktop.
Save vm6ej04/40ee7c328193425cf281b2f64b409a20 to your computer and use it in GitHub Desktop.
Force reload when click back/ forward button on iOS/ prevent button state stuck, etc. *back-forward cache
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload()
}
};
//JQUERY
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
window.location.reload()
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment