📌  相关文章
📜  javascript 显示本地存储大小 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:39.339000             🧑  作者: Mango

代码示例1
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();//