
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- HTML DOM localStorage Properties
- LocalStorage in ReactJS
- Set the size of the icons in HTML
- How to find the size of the plotting window in R?
- How to find the size of a list in C#?
- How to find size of ArrayBlockingQueue in android?
- How to use HTML5 localStorage and sessionStorage?
- How to find the object size in R?
- Clearing localStorage in JavaScript?
- How to find the size of an int[] in C/C++?
- How to change font size in HTML?
- How to store data in the browser with the HTML5 localStorage API?
- Find the size of a HashMap in Java
- Python program to Find the size of a Tuple
- HTML size Attribute
Advertisements