Search code examples
ioshtmlcordovamobilesafari

Mobile Safari LocalStorage Limit


I'm developing this cordova app which is required to save some data locally in case there is no internet connection available. This dataset also contains images in the form of a base64 string. Turns out I can roughly create about 7-8 items before my localstorage starts running out.

There seems to be a 5MB limit on almost all of the local storage techniques for mobile safari. After doing some googleing I couldn't find much concrete information on how to bypass this limit, as some apps are reported to have found a way around this restriction.

I'm currently using key value storage with that comes with Quasar Framework. (https://quasar-framework.org/components/web-storage.html) I'd love to keep using their API but if it's necessary I could always change some storage related code.

Is there a way to increase the size? I've ready about prompting the user for a storage increase but it's not explained anywhere specifically.

Thanks,


Solution

  • I had the same problem some time ago and i found no solution for localstorage.

    This article is interesting if you want more details about localstorage and its limits : https://www.raymondcamden.com/2015/04/14/blowing-up-localstorage-or-what-happens-when-you-exceed-quota

    To exceed this limit, I used IndexedDB which allows me to store much more data and especially to better store them.

    Raymond CAMDEN has written a very interesting article that will guide you : https://www.raymondcamden.com/2015/04/17/indexeddb-and-limits

    If you want to use IDB but are afraid of its complexity, there is Dexie.js which simplifies its use : http://dexie.org/