Search code examples
loadingofflinehtml5-appcachefallback

HTML5 appcache - Always load fallback if offline


I try to find a solution for my offline webapp. I have a fallback, but if i load the page online, i never return on the fallback page when i'm offline. If i had the page in the NETWORK section, i never see the fallback.

Example, a login page below

CACHE MANIFEST
# Version 2017-01-24 18:13:30
CACHE:
http://mil.mydomain.com/myjs.js
http://mil.mydomain.com/mycss.css
http://mil.mydomain.com/my-image.jpg

FALLBACK:
http://mil.mydomain.com/login http://mil.mydomain.com/fallback

Thanks you


Solution

  • Ok, the solution, after hours of searching is very simple... :'(

    If you don't want to always have the fallback page for a specific html page, you just need to remove the manifest attribute on the html tag on this page.

    http://mil.mydomain.com/login => <html>
    http://mil.mydomain.com/all-other-page-of-your-website => <html manifest="mycache.appcache">
    

    And your page will always go on the fallback page if you are offline.