What are the ways of data storage in the browser?

Asked

Viewed 693 times

4

I need to store information in JSON format directly in the browser, I’ve heard of localStorage HTML5 however it has storage limits that I would like to extend if possible if there are no alternatives? I would not like to use cookies.

1 answer

3

According to this Wikipedia article in English, freely translated into Portuguese:

Storage size

Web Storage provides much more capacity (5 MB per source in Google Chrome, Mozilla Firefox and Opera; 10 MB per storage field in Internet Explorer; 25 MB per source on devices running Blackberry 10) compared to 4 kb (around 1000 times less space) available for cookies.

This seems space enough for the vast majority of applications. There is, however, no way to expand the storage limit unless an origin starts consuming more space than was previously allowed for it and this is not standardized through browsers.

An alternative seems to be to use the IndexedDB ("MDN - Using Indexeddb"). Nor is there a standardized data limit (Firefox does not impose a limit, with the maximum size of 50 MB for each entry, and Chrome calculates the data limit relative to the available space for each user, so it could not be trusted for arbitrary sizes either).

I believe you should test with the localStorage and if you cannot get your application running within a 5 MB limit test other solutions. The IndexedDB seems to be relatively well supported (check out the http://caniuse.com/).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.