Skip to content

Instantly share code, notes, and snippets.

@tbuckel
Last active December 19, 2015 08:39
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 tbuckel/5927485 to your computer and use it in GitHub Desktop.
Save tbuckel/5927485 to your computer and use it in GitHub Desktop.
HTML5 Application Cache refresh
window.applicationCache.addEventListener('updateready', function(e) {
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Browser downloaded a new app cache.
// Swap it in and reload the page to get the new hotness.
window.applicationCache.swapCache();
if (confirm('A new version of this site is available. Load it?')) {
window.location.reload();
}
} else {
// Manifest didn't changed. Nothing new to server.
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment