您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何在HTML中找到localStorage的大小?

2024/3/27 14:30:34发布9次查看
localstorage 用于跨多个会话保存信息。它的最大大小为 5mb。
示例您可以尝试运行以下代码片段来检查分配的大小 -
var sum = 0;// loop for sizefor(var i in localstorage) { var amount = (localstorage[i].length * 2) / 1024 / 1024; sum += amount; document.write( i + " = " + amount.tofixed(2) + " mb");}document.write( "total = " + sum.tofixed(2) + " mb");
以上就是如何在html中找到localstorage的大小?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product