开发者

HTML5 localStorage space limit on iPad Safari

To clarify I'm referring to the key/value localStorage pairs, not Web S开发者_如何学CQL DB or IndexedDB.

Is it strictly a 5MB limit for the iPad, or is it true that it's unlimited but it will ask the user to allow/deny once you exceed 5MB?

I'm hoping to use localStorage to store a large amount of data and so is important that it's unlimited.


Have a look at how the Financial Times web app deals with it:

http://apps.ft.com/ftwebapp/

On installation it detects the limit and then provides instructions for the user to manually increase their limit to 50MB using the Settings app.

If there was an easier/automatic way to do this, I'm sure they'd use it.


Yes, it's the same limit for iphone and other apple devices as well because of how Safari implemented localStorage. Take a look at this

Limit of localstorage on iPhone?


Safari mobile is limited at 50mb, if you try to write to local storage over the storage quota it will throw an exception. There is no way to check how much space is remaining, you simply have to try to write and catch the exception. Pretty terrible.

Below are some articles on the limits of the various storage types. The conclusion is Safari mobile sucks.

https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa

https://en.wikipedia.org/wiki/Web_storage

https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bg142799(v=vs.85)#_objmodel:

https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa

https://www.html5rocks.com/en/tutorials/offline/quota-research/


I know you are looking for localstorage key/value pairs. Just like myself. I tried a native solution and apparently my iPad had 2.5 MB only for localstorage. So I switched to locaForage which is a IndexedDB (+more) wrapper in a very similar to localstorage api. It doesnt have these limitations of localstorage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜