cookies maxvalue
Since I'm very into cookies lately, I have this question:
Is it possible to have more than 20 cookievalues in your cookiefile? If yes, how?
Thanx in advance,
Shakespeare: onclick || !(onclick)
Since I'm very into cookies lately, I have this question:
Is it possible to have more than 20 cookievalues in your cookiefile? If yes, how?
Thanx in advance,
Shakespeare: onclick || !(onclick)
detox posted this at 02:24 — 24th January 2002.
They have: 571 posts
Joined: Feb 2001
A cookie can hold a maximum of 4096 bytes (4 KB) so however much you can fot into that is the maximum I guess. I would stay away from putting too much into a cookie though..
This is taken from a reference book i have.
What it is basically saying is that depending too much on cookies for state management creates huge overheads. You can have a hell of a lot of values in a cookie but if you are servicing a lot of users, it is not worth the cost in bandwidth.
What I would suggest is have a key value in a cookie (if that is what you want to maintain state with) and store the details in a db. That way you are not having to worry about the other issues that come with overuse of cookies.
Jack Michaelson posted this at 10:33 — 24th January 2002.
He has: 1,733 posts
Joined: Dec 1999
Actually that is what I have. My question was actually if it is possible to store more than 20 key values in a cookie?
Sorry for making that not clear in the first post.
Shakespeare: onclick || !(onclick)
Wil posted this at 11:02 — 24th January 2002.
They have: 601 posts
Joined: Nov 2001
I know that you can only set a maximum of 20 cookies per domain, if that's what you're asking.
If you find yourself reaching this limit, load one cookie with some infromation deliminated by a given field then use your script to deliminate the stored infrormation.
- wil
detox posted this at 12:14 — 24th January 2002.
They have: 571 posts
Joined: Feb 2001
I actually answered the question in the first line of the reply!
meaning if you can fit 20 key values into a cookie then go ahead, but the limit is 4kb, you should be able to fit in a fair bit. What I was saying was there is a size limit not a maximum number of values limit with cookies.
The rest of the reply was for everyone else who is considering using cookies for state management, and I think there are better ways of doing so.
Jack Michaelson posted this at 12:30 — 24th January 2002.
He has: 1,733 posts
Joined: Dec 1999
YES! That's what I'm asking, sorry for not being specific enough
Thanx for the answers! So 20 is the real limit?
Shakespeare: onclick || !(onclick)
Wil posted this at 13:41 — 24th January 2002.
They have: 601 posts
Joined: Nov 2001
Yes. As far as I know, anyway. Not sure how updated this information is. Couldn't find any RTF on the subject.
http://www.cookiecentral.com/faq/#4.7
ZDNet also backs up this claim => http://www.zdnet.com/devhead/stories/articles/0,4413,1600620,00.html
What you do then is to load one cookie with loads of different information deliminated by a given field. As in.
user|password|status
And then get your script to split these fields. This saves up on the amount of cookies you use. A little extra work, but the only known workaround I think.
Or you could try fooling the brwoser by sending cookies to different sub-domains, like it says in the URL above.
HTH.
- wil
Jack Michaelson posted this at 15:14 — 24th January 2002.
He has: 1,733 posts
Joined: Dec 1999
Yeah, that's what I do right now, but I want more
My cookiefile looks something like this:
Cookie.name1|status1
Cookie.name2|status2
Cookie.name3|status3
etc... until 20.
But I want it to be:
Cookie.name1|status1
Cookie.name2|status2
Cookie.name3|status3
etc... until more than 20.
CONTEXT:
It's the user who defines the value for cookie.name[i] and I let him select his desired status by placing all available cookie.names in a . But I want him to choose out of more than 20 statusses (what's the plural of 'status' ), but it seems like that's pretty impossible.
Gonna look after your 'sub-domain solution' though
Thanx for the links!
Shakespeare: onclick || !(onclick)
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.