存储 storage 大小测试 浏览器 5M 手机端没限制
作者:互联网
(function() {
var test = '0123456789';
var add = function(num) {
num += num;
if(num.length == 10240) {
test = num;
return;
}
add(num);
}
add(test);
var sum = test;
var show = setInterval(function(){
sum += test;
try {
plus.storage.removeItem('test');
plus.storage.setItem('test', sum);
console.log(sum.length / 1024 + 'KB');
} catch(e) {
alert(sum.length / 1024 + 'KB超出最大限制');
clearInterval(show);
}
}, 0.1)
})()
标签:浏览器,sum,storage,5M,var,add,num,test 来源: https://www.cnblogs.com/mrt-yyy/p/13161214.html