Reputation: 987
To clarify I'm referring to the key/value localStorage pairs, not Web SQL 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.
Upvotes: 5
Views: 16392
Reputation: 562
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.
Upvotes: 0
Reputation: 2949
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://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa
https://www.html5rocks.com/en/tutorials/offline/quota-research/
Upvotes: 0
Reputation: 40995
Have a look at how the Financial Times web app deals with it:
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.
Upvotes: 4
Reputation: 3875
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?
Upvotes: 0