Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i use local storage for storing values of multiple variables?

How can i use local storage for storing values of multiple variables ? is there any limit for local storage. which all browsers currently support local storage ?

like image 750
Sanooj Avatar asked Sep 28 '11 08:09

Sanooj


People also ask

How do I store multiple values in local storage?

Using code You can store the value in localStorage with the key value pair. It has two methods setItem(key, value) to store the value in the storage object and getItem(key) to retrieve the value from the storage object.

Can we store multiple values in localStorage?

If you want to store two different values in localStorage then you can do somrthing like this : setItem in localStorage two times with different keys. localStorage. setItem("message", taskMessage); localStorage.

Can we store data in local storage?

Any content/data saved to the localStorage object will be available after the browser has been restarted (closed and opened again). In order to save an item to localStorage , you can use the method setItem() . This method must be handed a key and a value.

Can local storage store array?

The array becomes a string and you can save it into your browser's local storage.


1 Answers

Here is a good discussion regarding HTML5 Local storage limits HTML5 localStorage size limit for subdomains

Regarding browsers, here is a list,

Firefox 3.5, Safari 4, IE8, Chrome 4+: HTML5 localStorage; these modern browsers all support the core localStorage functionality defined in the HTML5 draft.

Firefox 2.x and 3.0: Gecko globalStorage, a very early implementation similar to HTML5’s localStorage.

Safari 3.1 & 3.2: HTML5 Database Storage, because Safari 3.1 and 3.2 don’t support HTML5 localStorage.

IE6, IE7: userData persistence, a rarely used IE feature for associating string data with an element on a web page and persisting it between pageviews.

Google Chrome Pre 4: Gears Database API, which is built into earlier versions of Chrome and thus doesn’t require a separate install.

Here is alist of browsers that support this functionality. https://stackoverflow.com/questions/1194784/which-browsers-support-html5-offline-storage

There is no limit for the number of variables, a detailed explanation for using HTML5 local storage can be found here

like image 121
nbk Avatar answered Sep 27 '22 20:09

nbk