I have an offline-friendly Angular SPA set up as follows:
- Using cache manifest to save all static assets to application cache.
- Using JS that will auto-reload the page whenever an update in the cache manifest file has been detected. Usually this means that, if there is an update, the page will reload shortly after opening or refreshing the page.
- Set up HTTP headers so that none of the static assets are stored in the normal browser cache (only in the appcache); this ensures that the auto-reload behavior will always show the latest assets.
All of this works fine, except for one caveat: The browser will only check for cache manifest updates when the page is reloaded, but since the app is a SPA, the user could conceivably be using the app for a long time (and changing views within the page many times) without reloading the app's single page, which brings me to my question. Is there some kind of JS that I could add such that the browser would look for a cache manifest update whenever the user changes views in the SPA without the user having to reload the page itself. The only thing I can think of is to automatically reload the page every time the view changes, thus forcing the browser to look for a cache manifest update on every view change, but this seems counter-intuitive since it is a SPA.