Home  >  Article  >  Web Front-end  >  Questions about the number and size of COOKIE_javascript skills

Questions about the number and size of COOKIE_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:11:55958browse

To be honest, I rarely pay attention to this issue in my daily use of JS and rarely use cookies, so I was dumbfounded when I was asked this time. I couldn't explain why, so in the end I just said: I can honestly admit that I don’t know much about the operation of this cookie. Today, a colleague asked about cookies again, so I checked online and made some relevant summaries and recorded them for future reference. As a JS programmer, you should be relatively familiar with the operation of cookies, so I won’t explain it too much.

The following are the different restrictions on cookies between browsers:

IE6.0

 

IE6.0

IE7.0/8.0

Opera

FF

Safari

Chrome

cookie个数:

每个域为20个

每个域为50个

每个域为30个

每个域为50个

没有个数限制

每个域为53个

cookie总大小:

4095个字节

4095个字节

4096个字节

4097个字节

4097个字节

4097个字节

IE7.0/8.0

Opera

FF

Safari

Chrome

Number of cookies:

20 for each domain

50 for each domain

30 for each domain

50 for each domain

No limit on number

53 for each domain

Total cookie size:

4095 bytes

4095 bytes

4096 bytes

4097 bytes

4097 bytes

4097 bytes

Processing operations after the number limit is exceeded: 1. The processing of IE and Opera is the same. They all use the "least recently used algorithm". When the cookie limit has been reached, the oldest cookies will be automatically removed to leave available space for the newest cookies. 2. FF is very special. Although the last cookie set will be retained, it seems to have no rules to randomly delete existing cookies. Remarks: When we perform page cookie operations, we should try to ensure the number and corresponding size of cookies. The best number of cookies is < 20~30; the best cookie size is < 4K
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn