今天活儿不多,在整理自己有关于 Cookie 的知识。 对于 Cookie 的缺陷,MDN 是这样写的: 3.Cookie 的大小限制在 4KB 左右。对于复杂的存储需求来说是不够用的。
然后发现《 JavaScript 权威指南》 20.2.4 对于 Cookie 的局限性是这样描写的:
5.3 Implementation Limits
Practical user agent implementations have limits on the number and size of cookies that they can store. In general, user agents' cookie support should have no fixed limits. They should strive to store as many frequently-used cookies as possible. Furthermore, general-use user agents SHOULD provide each of the following minimum capabilities individually, although not necessarily simultaneously:
* at least 300 cookies
* at least 4096 bytes per cookie (as measured by the characters
that comprise the cookie non-terminal in the syntax description
of the Set-Cookie2 header, and as received in the Set-Cookie2
header)
* at least 20 cookies per unique host or domain name
我瞬间懵逼了啊!!人家不明明说的是 at least 300 cookies 么!不是明明就是 at least 4096 bytes 么!按照我的理解,也就是说,标准根本就没有做限制,现在的限制标准只是浏览器自己加的吧!
感觉自己瞬间卡住了,没法总结了,求 V2 的老司机指点一下,是我理解错了吗,还是书上扯淡了?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.