Mobile Safari LocalStorage Limit - ios

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,

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/

You may be able to use more browser storage by using a different API such as IndexedDB. https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria

Related

iOS UIWebView - caching assets in native apap

I am evaluating a project that was originally targeted to be just a PWA using React and Redux.
The application needs offline support though, and needs a sizable amount of media assets (images and videos) to be available offline.
Since the service worker storage limit is just 50MB, this is not feasible for iOS.
I have toyed with the idea of using a native app wrapper that handles the storage of the media files, with most of the app remaining a Redux/React implementation.
Is there a good way to expose such assets from to the UIWebView from the native app? Or are there other common approaches for this situation?
First off all you should try to cache only that assets which are necessary for your PWA.However still if you want to store large files I would suggest you can go with IndexDB API.
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.
Why IndexDB?
When quota exceeds on IndexedDB API, the error calls the transaction's onabort() function with Event as an argument.
When a browser requests user a permission for extending storage size, all browsers call this function only when the user doesn't allow it, otherwise, continue the transaction.
If you want know about other possible DB I would suggest you to go through this link
https://www.html5rocks.com/en/tutorials/offline/quota-research/

Sync and Core Api's folderName and fileName character limits?

Hi I was wondering what the character limit for creating a folderName or fileName on the api?
I found this article, how accurate is it and how does it affect my app when it is syncing to the desktop ? https://www.dropbox.com/help/145/en
I don't believe there's a similar limit in the API/SDK itself (though you may run into issues with very long URLs when trying to make the API call itself), but you should consider that article accurate and keep that in mind. Changes made in the API do sync to desktop clients linked to the same Dropbox account, so if you need compatibility, you may want to check the length yourself in your app.

How to download and store images to not be cleared by device later?

I have an application which downloads its product data(descipttions and images) from server and stores them localy to be available offline. For product images I'm using forge.file.cacheURL which works great but on my iPAD, this cache is being cleared during the day when I work with another apps. This causes my application to have only descipription texts available without images and user must connect to internet and synchronize again what is quite annoying. Is there a better way how to implement this scenario?
Have you tried to use the forge.prefs module for this purpose? It allows you so persistantly save key-value-pairs locally (much like HTML5 localstorage). Read more about the exact syntax in Trigger.io's official API documentation.
I'm not quite sure whether its possible to save images with this method, but you could easily transform your images into strings and vice-versa. Check out the second chapter of this post by Robert Nyman on how to save images in localStorage.

HTML5 localStorage space limit on iPad Safari

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.
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.

HTML5 Ipad Error while downloading large numbers of pictures

I want to develop an offline html5 website with a large number of pictures (10 000).
The problem is that during the downloading process when safari ask me to increase the cache limit it stop the download and i need to start it again.
It's possible to make such application in html5 on a ipad ? can we breach the offline cach limit :) ?
Thks a lot in advance !!!!!!
The limit is set inside the browser itself, typically at 5MB. Currently, as far as I'm aware, the only way to increase it is by the user actually doing it via the browser menu.
There might be a way of increasing it programmatically, I don't know, but you would most certainly have to ask the user's permission to do so.
I also think it's a bit much to be expecting someone to allow 10k+ images to be stored on their system, that could be huge.

Resources