I'm wondering what's the limit of localstorage HTML 5 on iPhone? I read that it was like 5 Mb, but I'm surprised is so little. Any ideas?
-
Are you taling about the cache? if so this is a duplicate of http://stackoverflow.com/questions/805891/safari-cache-size-for-iphone-3-0 – cidered Dec 17 '09 at 12:15
-
4I'm refering to "HTML 5 client-side storage specification", it's not the cache sorry, it's the new possibility of HTML 5 to store information on a key-value storage http://developer.apple.com/safari/library/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/Name-ValueStorage/Name-ValueStorage.html#//apple_ref/doc/uid/TP40007256-CH6-SW1 – fesja Dec 17 '09 at 12:19
-
15Yes, this is relevant to web development on the iPhone. – Brad Larson Dec 17 '09 at 13:53
-
1Check this https://demo.agektmr.com/storage/ . This may be helpful – Eugene Hoza Nov 14 '17 at 09:22
4 Answers
Mobile Safari on the iPhone and iPad will hold 5MB before throwing a QUOTA_EXCEEDED_ERR
when using localStorage. If you're using HTML5 SQL, the user will be prompted at 5MB intervals to increase the storage limit.
Desktop Safari v4 does not have a limit, afaik, on localStorage. However, Safari v5 limits the site to 5MB before throwing a QUOTA_EXCEEDED_ERR
, exhibiting the same behavior as the mobile version.

- 77
- 12

- 1,377
- 10
- 16
-
-
-
3+1 The best answer. Everyone else seems a bit confused. `localStorage !== WebSQL storage`... – War10ck May 05 '14 at 19:06
"The current default on iPhone is 5.0 MB. If your database grows beyond this limit, the user will automatically be asked to allow or deny the size increase. If he allows the increase, the database size limit will be upped to 10.MB"
Source: http://ofps.oreilly.com/titles/9780596805784/ch05_id35816678.html#ch05_id35933214

- 4,968
- 1
- 47
- 60

- 3,915
- 10
- 49
- 61
-
2
-
1
-
3
-
12This is only true if you use the Web SQL Database http://dev.w3.org/html5/webdatabase/ not for Web Storage (javascript 'localStorage' key/val storage) http://dev.w3.org/html5/webstorage/ which will fail without letting the user increase space used. – antonj Feb 08 '11 at 12:29
-
1
There is a great way to tell the limit of your browser...

- 87
- 6
-
3Interesting page, not for Web SQL and such though. Unfortunately the developer has never heard about binary search, and also has a pretty weird definition of 'unlimited'. – grr Feb 14 '13 at 12:45
on January, 2021
Chrome and Safari over iPhone cant save more than 2750 Kbs in a localstorage var.
//HTML
<div> The localStorage limit is <span id="size">???</span> KBs. </div>
//JS
function gen(n) {
return new Array((n * 1024) + 1).join('a')
}
//window.localStorage.clear();
// Determine size of localStorage if it's not set
if (!localStorage.getItem('size')) {
var i = 0;
try {
// Test up to 10 MB
for (i = 0; i <= 10000; i += 250) {
localStorage.setItem('test', gen(i));
}
} catch (e) {
localStorage.removeItem('test');
localStorage.setItem('size', i ? i - 1 : 0);
}
}
var el = document.getElementById('size');
el.innerHTML = localStorage.getItem('size');

- 484
- 2
- 11
-
2750 seems to be the limitation nowadays. Also I've encountered some issues where the Safari has not thrown "quota exceeded" error when the local storage size goes just a bit over the limit when calling localStorage.setItem(). It just does not save anything. – P Roitto Nov 17 '21 at 12:26