允许的最大Cookie数 [英] Maximum number of cookies allowed

查看:133
本文介绍了允许的最大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.

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

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

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

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