Currently localStorage only supports strings as values, and the objects need to be converted to JSON strings before they are stored in the localStorage. Data stored using local storage isn’t sent back to the server (unlike cookies, ). All the data stays on the client-side, thus there is a defined limitation regarding the length of the values, and we can currently store from 2 MB to 10 MB size of data depending upon the browser we use.
localStorage.setItem ( 'abc', 10 ); // this integer 10 gets converted to a string "10" // and then stored in localStorage variable named "abc".
This code is to calculate the size of localStorage variable.
localStorage limit in your Browser is 5000 KBs.
- LocalStorage and SessionStorage | Web Storage APIs
- HTML | DOM Window localStorage Properties
- CSS | max-block-size Property
- CSS | max-inline-size Property
- HTML | DOM Meter max Property
- HTML | DOM Input Range max Property
- PHP Math Functions (is_nan, pow, sqrt, exp, log, log10, log1p, max, min, getrandmax, rand, mt_rand)
- PHP | max( ) Function
- D3.js | d3.max() function
- CSS | max-height Property
- CSS | max-width Property
- HTML | DOM Progress max Property
- PHP program to Generate the random number in the given range (min, max)
- HTML | DOM Input Datetime max Property
- HTML | DOM Input Date max Property
- HTML | DOM Input DatetimeLocal max Property
- HTML | DOM Input Number max Property
- HTML | DOM Input Week max Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.