PWA on IOS and offline storage

前端 未结 2 977
清歌不尽
清歌不尽 2021-02-08 21:54

We looking to develop an \"App\" which would have the ability to record the details of a damaged car for assessors. The idea is that a small number of assessors would have compa

相关标签:
2条回答
  • 2021-02-08 22:22

    Firstly, iOS restricts third party web browsers (or any app that displays web pages) to using its own engine - installing Chrome on an iPad will not enable access to any web APIs that iOS/Safari doesn't already support.

    So in particular:

    • File System API is not available on iOS, even if you're using Chrome
    • Cache API has a storage limitation per website of 50MB
    • IndexedDB has a storage limitation per website of 500MB or half the device's free space (whichever is smaller)
    • PWAs and their cached data are automatically wiped from devices if not used for a few weeks
    • the "navigator.storage" API for requiring durable data is not support on iOS, even if you're using Chrome or Firefox.
    0 讨论(0)
  • 2021-02-08 22:34

    My first thought would be that if you are only going to support iPads and indefinite offline storage is a requirement, you are probably best of with a native application. Keep in mind that for this kind of application you would need the Apple Enterprise Program, which is more expensive than the regular Developer Program.

    However, if you do want to use a PWA, your best bet for local storage would be the IndexedDB. As per the comment by skybondsor, browsers do indeed limit and possibly evict data after a while, according to ADM webdocs.

    But reading your question, I get the sense that you do not really need persistent local storage, but rather a method ensuring that your data will eventually end up on the server. You can accomplish this by exploiting the Background Sync methodology. This allows your application to delay the upload to when a stable internet connection is available.

    0 讨论(0)
提交回复
热议问题