Skip to content

Instantly share code, notes, and snippets.

@sang4lv
Created January 5, 2013 11:16
Show Gist options
  • Save sang4lv/4461076 to your computer and use it in GitHub Desktop.
Save sang4lv/4461076 to your computer and use it in GitHub Desktop.
applicationCache: Overview
var appCache = window.applicationCache;
//Update when ready
appCache.onupdateready = function() {
if(appCache.status == 'UPDATEREADY') {
appCache.swapCache();
if(confirm("New content available. Reload to show?")) {
window.location.reload();
}
}
};
//Manual update
setInterval(function() {
appCache.update();
if (appCache.status == 'UPDATEREADY') {
appCache.swapCache(); // The fetch was successful, swap in the new cache.
}
}, 100000000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment