Results 1 to 4 of 4
Apr 5, 2011, 10:16 #1
How much data, or how long a string, will a cookie hold?
I am working on a web site that is going to need a cookie to hold a string of information.
I have got a few questions about storing data in a cookie:
1). How long a string of data, or how many characters, will a cookie hold?
Also, I am thinking about storing the data in a session cookie.
2-a). How much data will will a session cookie variable hold?
2-b). How much data will the entire session cookie hold?
Does anybody know where I can find answers to my questions?
Apr 5, 2011, 10:30 #2
I'm not sure what the limit is on cookies - sessions afaik don't necessarily have a limit.
However, remember the rule of upper limits: if you have to ask what the upper limit is, you're probably doing it wrong.
Not sure what you're trying to do exactly, but you shouldn't need to store a ton of information in either. Just store an identifying key in the session, and use that to pull the information you need from the database.aaron-fisher.com - PHP articles and more
Apr 5, 2011, 10:37 #3
- Join Date
- Apr 2008
- North-East, UK.
- 3 Post(s)
- 0 Thread(s)
Apr 5, 2011, 20:09 #4
Thanks for responding to my question.
For others who read this thread the link to the white paper provided by Anthony tells about storage requirements for cookies. It's about 3/4 down the page under the subheading "5.3 Implementation Limits"
It says there "In general, user agents' cookie support should have no fixed limits." (I think the term user agents refers to browsers)
I think that a cookie is like any other text file. I suppose that you can put lots of information in one. The limitation is only how much data your computer can handle. Most computers can handle huge text files.
It also says that the user agent (i.e. browser) should have the capacity to contain at least 4096 bytes of data in a cookie (if I am reading it right).
One byte of data equals one keyboard character.