How to create an offline enabled web-application such that when user visits hxxp://mywebsite/ and is offline than hxxp://mywebsite/offline/ is displayed. [There are about 100 different dynamic pages in my website, so I cannot afford to hardcode all of them in the cache manifest file]
相关问题
- Can you set the Location header in a chunked http
- What are the advantages ManageIQ has over OpenStac
- How can I make the angular.js route the long path
- .htaccess redirect all extension except css and ja
- Automatic authentication using Javascript?
相关文章
- HTML5 control
- File Upload of more than 4GB
- Returning plain text or other arbitary file in ASP
- AppCache Manifest Error
- how to Change glassfish application url
- How to handle dynamic elements using Robot Framewo
- How to create an installer for a Java EE Web appli
- How do you call a handler from your basehandler in
I reference "manifest.php" instead of "cache.manifest", then my php file looks like this:
The file hashes keep it up-to-date so that if any files change the manifest changes as well. Hope that helps :)
This will cause all your pages across the entire site to redirect to offline when offline. The only issue is with the page that declares the manifest as that page is always cached. This means you cannot declare the manifest on every page because every visited page will then be cached itself and not redirect. So what you can do is declare your manifest on another html file (IE. Synchronize.html) then from default check whether or not your app has been made available for offline by storing a cookie or localcache value. If not redirect to synchronize.html with the manifest declared, set the localcache value, and redirect back to index.
OFFLINE AWESOMENESSSSSSSSSSS!!!!
It's not possible to use wildcards in the cache manifest, at least it doesn't work in any current browser as far as I'm aware. An alternative approach might be to generate your cache manifest dynamically, and let a script generate all those fallback entries.
Reference your manifest file in an invisible iframe in your index page. That way your index page isn't cached as it is normally by default and you have total control over your fallbacks...
No need for unreliable cookies or localStorage!