允许的最大Cookie数

编程入门 行业动态 更新时间:2024-10-23 17:39:42
本文介绍了允许的最大Cookie数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Google搜索告诉我,最大允许的Cookie数量取决于浏览器,但是我无法找到任何有关在现代浏览器上允许多少Cookie的数据。

As far as Google searches tell me, the maximum allowed number of cookies depends very much on the browser, however I cannot find any recent data as to how much cookies are allowed on modern browsers.

我需要在Cookie中存储一些大量的用户偏好(对于尚未注册的用户),那么最好的办法是什么呢? (另外,这些Cookie将通过javascript客户端和php服务器端访问)

I need to store a somewhat large number of user preferences in cookies (for not-yet-registered users), so what would be the best way of doing that? (Also, those cookies would be accessed both via javascript client-side and php server-side)

推荐答案

从 rfc :

  • 至少300个Cookie

  • at least 300 cookies

每个Cookie至少有4096个字节(由组成字符的大小衡量) cookie非终端的语法 Set-Cookie头的描述)

at least 4096 bytes per cookie (as measured by the size of the characters that comprise the cookie non-terminal in the syntax description of the Set-Cookie header)

每个唯一主机或域名至少20个Cookie

at least 20 cookies per unique host or domain name

这些是最低要求。 IE6团队没有得到。一切都是高度浏览器特定的。你最好写一个测试平台来测试每个浏览器。

Those are minimum requirements. The IE6 team didn't get that. Everything else is highly browser-specific. You'd better write a test-platform to test each browser. Test the maximum size and number with little incremental steps (and check if they still are readable).

此外,我似乎记得apache有一个问题与huges数量的cookie 。

Also, I seem to remember apache has a problem with huges numbers of cookies. Can't remember where i've seen that though.

这里是一个小小的测试脚本: krijnhoetmer.nl/stuff/javascript/maximum-cookies/

Here is a little cookie-testing script: krijnhoetmer.nl/stuff/javascript/maximum-cookies/

更多推荐

允许的最大Cookie数

本文发布于:2023-10-27 22:59:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534791.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Cookie

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!