What are the ways to store data in the browser?

4

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

    
asked by anonymous 24.02.2015 / 16:51

1 answer

3

According to this wikipedia article in English , translated freely 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 of 1000 times less space) available for cookies.

This seems enough space for the vast majority of applications. There is, however, no way to expand the storage limit, unless a source starts to consume more space than was previously allowed for it and is not standardized across browsers.

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

I think you should test with localStorage and if you can not get your application running within a 5 MB limit, test other solutions. The IndexedDB API seems to be relatively well supported (check the link ).

    
24.02.2015 / 17:21