Questions about the number and size of cookies _javascript tips

Source: Internet
Author: User
Tags random shuffle
To tell you the truth, in the normal use of JS rarely to pay attention to this aspect of the problem is rarely used to cookies, so this time was asked a stunned, squeak and can not say a reason to come, and finally can only be honest to tell the operation of this cookie is not very understanding. Today, some colleagues asked about cookies, I went to the internet to do some of the relevant summary record down, for the time being. About the operation of cookies, as a JS programmer should be relatively familiar with some, so do not give it too much explanation.

Here are the different restrictions on cookies between browsers:

IE6.0

ie7.0/8.0

Opera

Ff

Safari

Chrome

Number of cookies:

Each domain is 20

Each domain is 50

Each domain is 30

Each domain is 50

No limit on number

Each domain is 53

Total Cookie Size:

4,095 bytes

4,095 bytes

4,096 bytes

4,097 bytes

4,097 bytes

4,097 bytes

Processing operations after the number limit is exceeded:

1, IE and opera's processing is the same. They all use the "least recently used algorithm", which automatically excludes the oldest cookie when the cookie has reached the limit to give the latest cookie a space to leave available.

2, FF is very special, although the last set of cookies will be preserved, but it seems that there is no random shuffle to delete existing cookies.

Note:

When we do the page cookie operation, we should try to ensure that the number of cookies and the corresponding size. The number of cookies is best < 20~30; Cookie size Best < 4K

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.