function getUseSize() { var size = 0; for(item in window.localStorage) { if(window.localStorage.hasOwnProperty(item)) { size += window.localStorage.getItem(item).length; } } console.log('使用:' + (size / 1024).toFixed(2) + 'KB') } getUseSize()
标签: JavaScript