Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 214
Crashalot Avatar asked Feb 04 '18 07:02

Crashalot


2 Answers

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!

like image 50
Crashalot Avatar answered Oct 20 '22 00:10

Crashalot


Here is a description of using offline cache on iOS:

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/OfflineApplicationCache/OfflineApplicationCache.html

like image 34
vekerdyb Avatar answered Oct 19 '22 23:10

vekerdyb