1

Whenever I update my webapp, the user must load the page twice in order to see the updates. Because the browser downloads the new updates after the app has already loaded.

Is there any way to attach a trigger to show "updating app" or something, then reload the page upon completion?

CACHE MANIFEST
# Dec 12, 2014 v4

CACHE:
index.html
/assets/css/main.css
http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic
http://fonts.googleapis.com/css?family=Raleway:400,300,700
http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
/assets/js/all.js?v=2

NETWORK:
*
HTTP://*
Adam
  • 9,189
  • 15
  • 46
  • 62

1 Answers1

2

You can use the events provided to detect an updated manifest using javascript:

function onUpdateReady() {
    window.location.reload();
}
window.applicationCache.addEventListener('updateready', onUpdateReady);
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
  onUpdateReady();
}

Source

There are more events you can use to detect certain states:

  • cached
  • checking
  • downloading
  • error
  • noupdate
  • obsolete
  • progress
  • updateready

Source