上代碼
(function () {
if (!window.localStorage) {
console.log('當前瀏覽器不支持localStorage!')
}
let test = '0123456789';
let add = function (num) {
num += num;
if (num.length == 10240) {
test = num;
return;
}
add(num);
}
add(test);
let sum = test;
let show = setInterval(function () {
sum += test;
try {
window.localStorage.removeItem('test');
window.localStorage.setItem('test', sum);
console.log(sum.length / 1024)
} catch (e) {
console.log("最大容量" + sum.length / 1024)
clearInterval(show);
}
}, 0.1)
})()
瀏覽器@版本 |
最大LocalStorage |
Chrome 84.0.4147.105 |
最大5M |
Firefox79.0 |
最大5M |
Edge |
最大5M |
IE |
最大3120kb,有毒 |