7

I plan to use persistant localStorage in one of my projects and i have found out that the size limitation is 5 MB (chrome). I searched other frameworks which implmented the same thing, like Mootools, Dojo, Lawnchair but i couldnt find out what are their size limitations.

Does anyone know what are the size limitation is in these. And what other options are there which i can use if not the one already stated above.

Pheonix
  • 6,049
  • 6
  • 30
  • 48
  • 5
    Fun fact: contrary to what you’d expect, the 5 MB limit is closer to 2600 characters than to 5000 characters due to the way the data is encoded internally ([UCS-2/UTF-16](http://mathiasbynens.be/notes/javascript-encoding)). Here’s a test: http://arty.name/localstorage.html – Mathias Bynens Feb 14 '12 at 20:50
  • @MathiasBynens right, nice to know :) – Pheonix Feb 14 '12 at 20:56
  • see http://stackoverflow.com/questions/3232872/is-5mb-the-de-facto-limit-for-w3c-web-storage – Kevin Hakanson Feb 14 '12 at 21:08
  • 5
    Surely that should be 2,600,000 characters? I doubt they used an encoding where each character takes 2KB. – qris Jan 10 '13 at 15:28

3 Answers3

9

localstorage limits are not tied to the javascript framework, but to the browser you're using. Currently specs are suggesting to limit the storage space to 5MB and this is the space maximum available on modern browser

On older versions of internet explorer (IE<8) userData behaviour (which mimics the localstorage) has a limit of 128kb for page (512kb is the maximum amount for an intranet page)

anyway for a complete list see http://dev-test.nemikor.com/web-storage/support-test/

Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177
  • ex lawnchair http://westcoastlogic.com/lawnchair/adapters/ is not using HTML5 localStorage, but various adapters are available, so i should still assume its maxed at 5 MB ? – Pheonix Feb 14 '12 at 20:51
2

you can use IndexedDB, but it's not supported by all browser, but it can be unlimited if user accept.

Community
  • 1
  • 1
Okan Kocyigit
  • 13,203
  • 18
  • 70
  • 129
  • the indexeddb is also not that reliable, some variant mobile browsers on android system, the limitation of around 50M does exist per test. – iefreer Feb 25 '22 at 07:35
0

If you store JSON into your localStorage you can save space using a compression tool, like : https://github.com/k-yak/JJLC