Created
September 25, 2012 11:58
-
-
Save gaelbillon/3781339 to your computer and use it in GitHub Desktop.
get localstorage size bookmarklet
This file contains 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
<a href="javascript:localStorageSize=null;for(var a=0;a<localStorage.length;a++)localStorageSize+=localStorage.getItem(localStorage.key(a)).length;var b=localStorageSize,c=['Bytes','KB','MB','GB','TB'];if(0==b)localStorageSize='n/a';else{var d=parseInt(Math.floor(Math.log(b)/Math.log(1024)),10);localStorageSize=0==d?b+' '+c[d]:(b/Math.pow(1024,d)).toFixed(1)+' '+c[d]}alert('localStorage is : '+localStorageSize);">localStorage Size</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment