What is the maximum size of a cookie, and how many can be stored in a browser for each web site?

后端 未结 9 1222
猫巷女王i
猫巷女王i 2020-11-27 16:36

I am learning about cookies, and I wonder about browser support when writing web applications that rely on cookies to store state.

  • For each domain/web site,

9条回答
  •  渐次进展
    2020-11-27 16:52

    Different browswers have different size limites on cookies. Here is the information for IE. Here is a page that lists several browsers.

    Cookies are not saved on a server basis but on a domain basis (a server may host many domains or the opposite a server farm may be serving a single domain).

    In general, I would avoid saving lots of information in cookies, as the data gets sent to and from the browser on every request. As you suggest in your question, this can have a effect on performance.

    Usually one stores small amounts of data in the cookie, mostly used to identify the user/session so more data can be picked up from a database or another resource local to the web server.

提交回复
热议问题