var sizeStore = 0;
if(window.localStorage) {
// 遍历所有存储
for(item in window.localStorage) {
if(window.localStorage.hasOwnProperty(item)) {
sizeStore += window.localStorage.getItem(item).length;
}
}
}
console.log((sizeStore / 1024 / 1024).toFixed(2) + 'M');
网友评论