Last active
December 19, 2015 08:39
-
-
Save tbuckel/5927485 to your computer and use it in GitHub Desktop.
HTML5 Application Cache refresh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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