任何人都可以解释一下window.localStorage的大小(例如,Firefox中的5MB)是每个范围5MB还是仅适用于所有范围?
解决方法
关于Firefox,引用
John Resig article(2007年1月发布)::
Storage Space
It is implied that,with DOM Storage,you have considerably more storage space than the typical user agent limitations imposed upon Cookies. However,the amount that is provided is not defined in the specification,nor is it meaningfully broadcast by the user agent.
If you look at the Mozilla source code we can see that 5120KB is the default storage size for an entire domain. This gives you considerably more space to work with than a typical 2KB cookie.
我猜它对所有其他浏览器都是一样的,但默认大小可能会有所不同.例如,在Internet Explorer 8中,默认值约为10Mb.引自@L_502_1@:
window.localStorage
The
localStorage
attribute provides persistent storage areas for domains. It allows Web applications to store nearly 10 MB of user data,such as entire documents or a user’s mailBox,on the client for performance reasons.