PWA Application is initialized every time after going background in iOS

≯℡__Kan透↙ 提交于 2019-12-02 20:42:34

Update : With the latest version of iOS(I've tested with 12.4), PWA state is preserved. Thanks to Leox and Roshil on confirming the same with another version.

Original answer to handle older version of iOS/Safari :

As mentioned in this article, iOS still doesn't preserve the state of a PWA app between sessions :( Since the first official support for service workers came just a week before(Late March-2018) in iOS, we can expect to see more features such as preserving the state in the future .

We are out of luck for now.

You can also see "What PWAs can do on Android and not on iOS" section in the linked article on current gaps between android and iOS with respect to PWA.

As a workaround, you can keep persisting the state of your application(current page, user filled data, scroll start if possible) in IndexDB and when the application is reopened you can read that to restore it. It works for pretty much most use cases.

Now you can update your iOS to 12.2 beta 5 to hold the state of the PWA app after restored it from minimized state. Thanks to Apple!

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