Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localStorage Size Limits... What are the options?

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.

like image 334
Pheonix Avatar asked Feb 14 '12 20:02

Pheonix


People also ask

What can I use instead of localStorage?

If neither cookies nor localStorage seem like the right fit, there is another alternative: IndexedDB, an in-browser database system. While localStorage performs all of its methods synchronously, IndexedDB calls them all asynchronously. This allows the accessing of the data without blocking the rest of your code.

Can I store large data in localStorage?

Each domain can store up to 5MB of data in LocalStorage. Also, our data isn't sent to the server when an HTTP request is made. Data in LocalStorage has no expiration time. It can be removed via JavaScript or by clearing the browser's cache.

Why is it better to use IndexedDB instead of localStorage?

The primary reason for introducing IndexedDB was to make a better version of localStorage. So, why not use IndexedDB in all cases? If you want to store structured data on the client side, IndexedDB is the better choice, especially since localStorage isn't built to store sensitive information.

How long localStorage objects can stores the data?

window.localStorage - stores data with no expiration date. window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)


2 Answers

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/

like image 72
Fabrizio Calderan Avatar answered Sep 20 '22 13:09

Fabrizio Calderan


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

like image 28
Okan Kocyigit Avatar answered Sep 20 '22 13:09

Okan Kocyigit