
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to find the size of localStorage in HTML?
localStorage is used to persist information across multiple sessions. It has a maximum size of 5MB.
Example
You can try to run the following code snippet to check the size allocated −
var sum = 0; // loop for size for(var i in localStorage) { var amount = (localStorage[i].length * 2) / 1024 / 1024; sum += amount; document.write( i + " = " + amount.toFixed(2) + " MB"); } document.write( "Total = " + sum.toFixed(2) + " MB");
- Related Articles
- HTML DOM localStorage Properties
- How to store objects in HTML5 localStorage?
- How to change font size in HTML?
- How to set checkbox size in HTML/CSS?
- LocalStorage in ReactJS
- How to use HTML5 localStorage and sessionStorage?
- How to store data in the browser with the HTML5 localStorage API?
- Set the size of the icons in HTML
- How to find the size of a list in C#?
- How to find size of ArrayBlockingQueue in android?
- Clearing localStorage in JavaScript?
- How to find the size of the plotting window in R?
- How to find the object size in R?
- How to set the favicon size in CSS rather than HTML attributes?
- How to find the size of an int[] in C/C++?

Advertisements