local storage size check

Solutions on MaxInterview for local storage size check by the best coders in the world

showing results for - "local storage size check"
Elif
04 Oct 2019
1 function getUsedLocalStorageSpace(){
2        var allStrings = '';
3        for(var key in window.localStorage){
4            if(window.localStorage.hasOwnProperty(key)){
5                allStrings += window.localStorage[key];
6            }
7        }
8        return allStrings ? 3 + ((allStrings.length*16)/(8*1024)) + ' KB' : 'Empty (0 KB)';
9 };
10 getUsedLocalStorageSpace();//