444683462
V2EX  ›  问与答

cookies 的默认大小限制究竟是多大。网上说是 20 条??4K??

  •  
  •   444683462 · Dec 3, 2014 · 3155 views
    This topic created in 4210 days ago, the information mentioned may be changed or developed.
    cookies的默认大小限制究竟是多大。网上说是20条??4K??
    3 replies    2014-12-03 14:13:21 +08:00
    barbery
        1
    barbery  
       Dec 3, 2014
    几年前是4K,不过现代浏览器都相应提升了吧,不同浏览器的规则不同
    raincious
        2
    raincious  
       Dec 3, 2014   ❤️ 1
    Practical user agent implementations have limits on the number and
    size of cookies that they can store. General-use user agents SHOULD
    provide each of the following minimum capabilities:

    o At least 4096 bytes per cookie (as measured by the sum of the
    length of the cookie's name, value, and attributes).

    o At least 50 cookies per domain.

    o At least 3000 cookies total.

    RFC6265: HTTP State Management Mechanism
    http://tools.ietf.org/html/rfc6265

    这里说的是SHOULD,因此你不能断定某些脑残浏览器会怎么定义自己的策略。不过按照这个标准执行不会错,忽略那些浏览器就好。
    Yo_oY
        3
    Yo_oY  
       Dec 3, 2014
    @raincious 说个跑题的,被你的头像骗到了,还以为V2EX改版了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2718 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:43 · PVG 19:43 · LAX 04:43 · JFK 07:43
    ♥ Do have faith in what you're doing.