Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fcaldarelli/3ce2f78933900b912bea to your computer and use it in GitHub Desktop.
Save fcaldarelli/3ce2f78933900b912bea to your computer and use it in GitHub Desktop.
Prevent Safari loading from cache when back button is clicked
// Javascript
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload()
}
};
// JQuery
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
window.location.reload()
}
});
@shqear93
Copy link

it doesn't work anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment