iOS 12 does not support offline feature of some PWAs

半城伤御伤魂 提交于 2019-12-10 10:25:05

问题


iOS 12 Safari does not support the offline feature of some PWAs (Progressive Web App). It seems like Safari does not cache resources in those web apps properly.

For example, the following PWAs cannot work offline in iOS 12 and 12.1, but they all work perfectly in Chrome on Android or Windows:

The Air Horner PWA that is used by google to demonstrate Service Worker:
Air Horner

And these two:
2048 puzzle
Voice Memos

Steps to reproduce (100% reproducible):

  1. visit the PWA with Safari (iOS 12 or 12.1)
  2. close the PWA tab in Safari
  3. push home button on iPhone to set Safari to background
  4. push the iPhone power button to turn off screen
  5. push the iPhone power button again to wake up the phone
  6. turn off all the network connection from the iPhone control center (both wifi and cellular)
  7. open Safari, visit PWA again --> the web app fail to load

This has been bothering me for a long time, as my own web app also has the similar issue - works fine in Chrome on Android / Windows but only fails on iOS 12 Safari. Any idea what special in iOS 12 Safari? Thank you very much!


回答1:


I had the same issue, using service worker without Workbox resolved the problem - app starts without internet connection but something is messed up with caching - it's not working.




回答2:


I faced the exact same issues.

What I realized is, all the caches are set correctly when the service worker is activated, but if you close safari with the iOS task manager (not only reduce it), all cached files get completely deleted when going back on the PWA.




回答3:


Indeed offline works in the Homescreen. However, the cache does not get updated on new versions & the Homescreen link stops working. To refresh the cache, one is obliged to access the web app from Safari, and then it works again. This is really sub-optimal & will hopefully be fixed.




回答4:


The issue is resolved in iOS 12.1.2 on my iPhone 6S.



来源:https://stackoverflow.com/questions/53439379/ios-12-does-not-support-offline-feature-of-some-pwas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!