【发布时间】:2012-01-10 20:55:01
【问题描述】:
在使用 localStorage 时,密钥是否有任何限制(最多为可用的本地存储量)?
即我可以这样做吗:
localStorage.setItem("pretend that this is a 1MB string", "whatever");
【问题讨论】:
标签: html local-storage
在使用 localStorage 时,密钥是否有任何限制(最多为可用的本地存储量)?
即我可以这样做吗:
localStorage.setItem("pretend that this is a 1MB string", "whatever");
【问题讨论】:
标签: html local-storage
是的,每个域的限制为 5MB。 您的字符串可以任意长。但是,总使用量必须低于 5 MB。
http://dev.w3.org/html5/webstorage/
http://www.stackoverflow.com/questions/2747285/html5-localstorage-restrictions-and-limits
【讨论】:
localStorage.clear();localStorage.setItem(new Array(5e6).join(' '),'');localStorage.key(0).length;
UIWebView 中测试,限制为 ~2.6MB。