I need to create a web application with offline support. When the client's computer goes offline, Javascript must redirect to another page with important information from the application.
Redirect to offline webpage
window.addEventListener("offline", function(e) {
document.location.href='/offline/index.html';
}
, false);
How to force save page /offline/index.html
in the browser's cache to make sure that the content will be available when the internet connection is broken?
The /offline/index.html
page will be updated every 10 minutes (if the app is online) and the cache must be still refreshed.
--
I tried to use cache manifest in the main app's html, but this is not working correctly. The offline page was saved, but other pages in online mode are saved too. I need to cache only one file, offline/index.html
, and I prefer to manually redirect to the offline page with a Javascript event without HTML5 offline solutions.
My cache manifest file:
CACHE MANIFEST
/ff/landing/js/jquery.min.js
/ff/default/js/online.js
FALLBACK:
/ /offline/index.html
NETWORK:
*