HTML5 LocalStorage大小 [英] HTML5 LocalStorage size

查看:112
本文介绍了HTML5 LocalStorage大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释我的window.localStorage的大小(例如,5MB在Firefox中)为每个范围5MB或只为所有?

解决方案

关于Firefox,引用 John Resig文章(2007年1月发布) :: b
$ b


存储空间



这意味着,使用DOM Storage,您拥有的存储空间要比Cookie上强加的典型用户代理限制多得多。但是,提供的数量没有在规范中定义,也没有被用户代理广播。

如果你看看Mozilla的源代码,我们可以看到5120KB是整个域的默认存储大小。这比起一个典型的2KB的cookie来,可以给你更多的空间。


我想所有的浏览器都是一样的,默认大小可以变化。例如,在Internet Explorer 8中,默认大约是10Mb。从有关DOM存储的MSDN文章中引用
$ b


window.localStorage



localStorage 属性为域提供持久存储区域。它允许Web应用程序出于性能原因在客户端上存储将近10 MB的用户数据,例如整个文档或用户的邮箱。


Can anyone explain me the size of window.localStorage (for example, 5MB in Firefox) is 5MB for each scope or only for all?

解决方案

Regarding Firefox, quoting fron a John Resig article (posted January 2007)::

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.

I guess it's the same for all the other browsers, but the default size can vary. For example, in Internet Explorer 8, the default is around 10Mb. Quoting from the MSDN article on DOM Storage:

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.

这篇关于HTML5 LocalStorage大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆