Cookie length limit

Source: Internet
Author: User
Tags set cookie

I. The Browser allows the number of cookies contained in each domain name:

Microsoft pointed out that internetexplorer8 adds a cookie limit of 50 for each domain name, But IE7 also seems to allow 50 cookies for each domain name.

Firefox has a maximum of 50 cookies for each domain name.

Opera has a maximum of 30 cookies for each domain name.

Safari/WebKit seems to have no cookie restrictions. However, if there are many cookies, the header size will exceed the server's processing limit, which may cause errors.

Note: "Each domain name has 20 cookies" is no longer correct!

2. When many cookies are set, how does the browser respond.

Besides Safari (you can set all cookies regardless of the number of cookies), there are two methods:

Least recently used (leastrecentlyused (LRU) method: When the cookie has reached the limit, the oldest cookie is automatically kicked out to make some space for the latest cookie. Internetexplorer and opera use this method.

Firefox is unique: although the last set cookie is always retained, it seems that it randomly determines which cookies are retained. There seems to be no plan (we recommend that you do not exceed the cookie limit in Firefox ).

3. Different browsers have different cookie sizes:

Firefox and Safari allow cookies to contain up to 4097 bytes, including names, values, and equal signs.

Opera allows cookies to contain up to 4096 bytes, including name, value, and equal sign.

Internetexplorer allows cookies to contain up to 4095 bytes, including name, value, and equal sign.

Note: Multi-byte characters are calculated as two bytes. In all browsers, any cookie that exceeds the limit is ignored and never set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.