Created
January 5, 2013 11:16
-
-
Save sang4lv/4461076 to your computer and use it in GitHub Desktop.
applicationCache: Overview
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
| 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