浏览器LocalStorage大小(win10)
转载声明:
本文为摘录自“csdn博客”,版权归原作者所有。
温馨提示:
为了更好的体验,请点击原文链接进行浏览
摘录时间:
2021-11-27 16:44:32
上代码
(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,有毒 |