今天活儿不多,在整理自己有关于 Cookie 的知识。 对于 Cookie 的缺陷,MDN 是这样写的: 3.Cookie 的大小限制在 4KB 左右。对于复杂的存储需求来说是不够用的。
然后发现《 JavaScript 权威指南》 20.2.4 对于 Cookie 的局限性是这样描写的:
然后我一时兴起就去找了一下所谓的[RFC2965]( https://www.ietf.org/rfc/rfc2965.txt )
原文是这样的:
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 的老司机指点一下,是我理解错了吗,还是书上扯淡了?