Created
January 12, 2013 19:19
-
-
Save glynrob/4520053 to your computer and use it in GitHub Desktop.
Get current size of localStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sizeofAllStorage(){ // provide the size in bytes of the data currently stored | |
var size = 0; | |
for (i=0; i<=localStorage.length-1; i++) | |
{ | |
key = localStorage.key(i); | |
size += lengthInUtf8Bytes(localStorage.getItem(key)); | |
} | |
return size; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment