Last active
July 25, 2017 20:35
-
-
Save beebole/fb926ad2a5405c955ca8df9aa714a85f to your computer and use it in GitHub Desktop.
Mobile offline - AppCache setup
This file contains 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
//Check if a new cache is available on page load. | |
window.addEventListener('load', function( ) { | |
window.applicationCache.addEventListener('updateready', function( ) { | |
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) { | |
window.applicationCache.swapCache(); | |
window.location.reload( true ); | |
} else { | |
// Manifest didn't changed. Nothing new to server. | |
} | |
}, false); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment