What is the number and size of cookies allowed by major browsers?

后端 未结 3 1312
抹茶落季
抹茶落季 2020-12-20 16:19

Just wondering what is the size and number of cookies allowed by IE, FF, Chrome, and Safari. What is the number allowed per host and the size of each cookie? Also what would

3条回答
  •  臣服心动
    2020-12-20 16:39

    I looked into this today, if you want to support most browsers, then don't exceed 30 cookies per domain, and don't exceed 4095 bytes per domain (i.e. total size of all cookies <= 4095 bytes).

    As for what happens when you exceed the limit, that depends on each browser and which limit you exceed. For example, in Chrome 8, when I add cookie 181, 20 cookies get deleted. Also in chrome 8, when I add a cookie with 5000 bytes, it gets truncated down to 4096 bytes. I suspect truncating is the standard way to handle over sized cookies.

    To read more about it here is my test page and results.

提交回复
热议问题