简体   繁体   中英

What happens if I exceed the limit of maximum cookies

As far as I read there is are two limits on the number of cookies :

  • 20 cookies per unique host or domain name
  • a total of 300 cookies

What does happen if I exceed one of these limits ?

Short Answer:

  1. If you exceed the limits per host/domain, the cookies simply won't be saved .

  2. If you exceed the total number of cookies, Your browser will alert you that the maximum number of cookies has been reached

Note that your question states that the max number of cookies per host is 20 and the total allowed is 300. However, this is not completely true. The number of maximum cookies is highly dependent on the Browser. For example,

  • Chrome 9 allowed 180 cookies per domain
  • Firefox 3.6.3 allowed 50 cookies per domain

As far as the RFC spec goes, the minimum requirements are:

  • at least 300 cookies
  • at least 4096 bytes per cookie
  • at least 20 cookies per unique host or domain name

This resource can help you test browser cookie limits. Also this SO post will shed some light on the design and performance aspect.

References : Cookie Limit per domain , Browser Cookie Restrictions

我尝试通过快速循环(一次 100 个)添加大量 cookie,Chrome 69.0.3497 和 FireFox 62.0.3 删除旧的 cookie 并存储新的 cookie。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM