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

后端 未结 9 1221
猫巷女王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 17:18

    If you're programming a web site, it's a good idea not to store too much in a cookie, because that cookie gets send to the server every time the user requests a page from your site. A far better solution is to just store a unique id in the cookie, and let the server pull up the required information from a database or file store based on that unique id. Unfortunately that solution leads to people worrying about what you're tracking about them, so you might want to have a "cookie policy" expressed somewhere on your site talking about why you're placing a cookie on their browser and what you do and don't track about them.

提交回复
热议问题