I trying to use Client Side Storage available in HTML5 (localStorage) for Iphone Application , and I'm completely aware of the "QUOTA" associated for localStorage(which is currently 5MB).
Now the problem is for a my application (with no data previously stored) . trying to store the data in localStorage is resulting in QUOTA_EXCEEDED_ERR although the size of the overall data is way less than 5 MB (~ 4Kb to be precise ( found using chrome web inspector in normal browser) )
Can anyone Share some light on this that how a data weigh 4Kb is resulting in QUOTA_EXCEEDED_ERR when the upper limit for the same 5MB
Note that the issue is only occurring for iPhone ,all the browsers and even the iPhone Simulator doesn't prompt with QUOTA_EXCEEDED_ERR error
iPhone currently is picture is iPhone 4 .
localStorage works on desktop but not mobile (iOS version 12.2)
Local storage and session storage now work in Safari 10.1 and later.
It is limited to about 5MB and can contain only strings. LocalStorage is not accessible from web workers or service workers. Cookies have their uses, but should not be used for storage.
Edit chrome/common/extensions/api/storage. json, change the "local" QUOTA_BYTES value, and rebuild chrome.
Go into Settings->Safari and check to see if private browsing is on. If it is, local storage will not be able to store anything. Here's some basic code to check local storage for you:
if (!!window.localStorage)
{
localStorage.setItem(key, val);
};
Also, how are you setting it? Are you using localStorage.setItem(key, val)
, or trying localStorage(key, val)
? You're problem might be coming from setting it incorrectly
I had the same issue and JoeCortopassi is only partly right: it is caused by private browsing being enabled. The code provided in that answer does not help much though. When I tested on iPad Safari(ios5) I got
console.log(!!window.localStorage); // true
As soon as I try to set a value, I get an exception:
localStorage.setItem("test", "test") // Exception 22 is thrown
So to accurately test for local storage support, it is necessary to try and set a value in local storage, for example:
var localStorageSupported = function() {
try {
localStorage.setItem("test", "test");
localStorage.removeItem("test");
return true;
} catch(e){
return false;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With