Share

I discovered there were limits on the size of cookies recently while trying to save search form data to a cookie. In the end I had to save each search form in to a single cookie as a delimited list (a kind of ad-hoc array). I hope this saves someone the time it took me to work out why my cookies were being deleted…

There are a number of important limitations on the use of cookies by Web site developers. This is because cookies are intended to be used only for infrequent storage of small amounts of data on the user’s machine. Although how much cookie information is stored and for how long is up to the browser makers, the following limits generally apply:

  • 300 Cookies total
  • 20 Cookies per server (not per page or site)
  • 4K of data per cookie (both the name and value of the cookie count towards this limit)

As a result, it’s not a good idea to create separate cookies for each value you’d like to save. Instead, combine those values into a single cookie separated by a known delimiter.

(Source: http://www.devx.com/tips/Tip/12646)

Share

You might also like:

  • No related entries were found