Search code examples
ioscachingweb-applicationsofflinehomescreen

iOS: Web app added to home screen not working in offline mode


This question is similar, but the answer did not help.

The goal is to cache a single web page to the home screen, and launch this web page successfully even in offline mode.

Launching the web page from the home screen succeeds when there's a network, but it fails in offline mode because Safari complains there's no connection the server.

The web page contains this meta tag:

  <meta name="apple-mobile-web-app-capable" content="yes"  />

Is this possible with web apps on iOS?


Solution

  • We fixed this by supporting a cached version of the app with the manifest attribute as follows:

    <!DOCTYPE HTML>
    <html manifest="/cache.manifest">
    ....
    </html>
    

    The cache.manifest file:

    CACHE MANIFEST
    
    # Version 0.0.2
    
    NETWORK: *
    
    CACHE:
    ShareIconTutorial.png
    HomeScreenIcon.png
    
    FALLBACK:
    

    Documentation is outdated on this topic because of PWAs, so hope this helps someone in the future!