Answers for "javascript show localstorage size"

1

javascript show localstorage size

function getUsedLocalStorageSpace(){
        var allStrings = '';
        for(var key in window.localStorage){
            if(window.localStorage.hasOwnProperty(key)){
                allStrings += window.localStorage[key];
            }
        }
        return allStrings ? 3 + ((allStrings.length*16)/(8*1024)) + ' KB' : 'Empty (0 KB)';
 };
 getUsedLocalStorageSpace();//
Posted by: Guest on April-23-2021

Code answers related to "javascript show localstorage size"

Code answers related to "Javascript"

Browse Popular Code Answers by Language