Skip to content

Instantly share code, notes, and snippets.

@beebole
Last active July 25, 2017 20:35
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 beebole/fb926ad2a5405c955ca8df9aa714a85f to your computer and use it in GitHub Desktop.
Save beebole/fb926ad2a5405c955ca8df9aa714a85f to your computer and use it in GitHub Desktop.
Mobile offline - AppCache setup
//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