Maximum number and size of cookies

8

While investigating cookies and their limitations, I came across this Microsoft page where they talk about Internet Explorer and its capabilities regarding Cookies:

> Cookie Size and Number Limits in Internet Explorer

  Microsoft Internet Explorer complies with the following RFC 2109 recommended minimum limitations:

     
  • at least 300 cookies
  •   
  • At least 4096 bytes per cookie (as measured by the size of the characters that make up the terminal in the description of the syntax of the Set-Cookie cookie header)
  •   
  • at least 20 cookies per hostname or unique domain
  •   

I also saw the rules:

that establish the basic behavior to standardize the use and availability of cookies in the various browsers available, where in brief they say that limited browsers should at least provide what was already mentioned in the article quoted above .

However, I have not been clear enough about an acceptable number of cookies that will work on all browsers most used , as well as the maximum size that each cookie may contain in order to ensure that there is no loss of data in the application.

The most commonly used browsers (IE, FF, Chrome and Safari) are in doubt as to whether they will be governed by the above mentioned minimums, or in fact we have a slightly greater margin for use of cookies from the same domain.

Similarly, when referring to domain in the standards presented, you are saying that www.site.com is different from app.site.com, or the limits will have to be shared by both ?

Question

Assuming such a scenario:

  • www.mysite.com Institutional Web-site
  • app.mysite.com Desktop application
  • m.mySite.com mobile version of the institutional web-site
  • cdn.mysite.com CDN to serve images and shared resources to those listed above

With what can you count on the number of cookies and their value in bytes to ensure that the whole solution for *.mySite.com will work?

    
asked by anonymous 28.01.2014 / 00:31

1 answer

5

Second Internet Explorer Cookie Internals from Microsoft, both Internet Explorer and Firefox have a limit of 50 cookies per domain where:

  • Each cookie can not be more than 5kb;
  • document.cookie has its own limit of only 10kb;

Answering your question:

  

With what you can count on the number of cookies and your   value in bytes to ensure that the solution to   * .mySite.com will work?

You can count up to 50 cookies and a maximum of 250kb of data per request per site.

My advice is to forget cookies and start using localStorage. It is basically supported on all modern versions of browsers (IE since version 8, safari version 4) and supports large amounts of data .

    
28.01.2014 / 05:27