/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] cookies: all is saved, but after a certain size it is "ignored"

Hello,

First, I have read that if you use multiple cookies, that each cookie can be up to 4Kb in size. I am using cookie code that has been successful in the past, but I have not tried to store over 4Kb before.

So, in my cookie code I use four cookies, which should mean that i have 16Kb to play with (I only need about 6Kb total, but multiple cookies also makes it easier to find stored information).

cookies:
1. mRdm //stores if this is the user’s first visit (e.g., mRdm1)
2. mngrTasks //array of pointers to the order of 125 randomized items (e.g., mngrTasks16:2:34:56)
3. mCats //array of main categories assigned to mngrTasks — max size of user entry is 20 characters (e.g., mCatsaaaaa:ccc:eeeeeeeee)
4. sCats //array of secondary categories assigned to mngrTasks — max size of user entry is 20 characters (e.g.sCatsbbb:ddd:fff)

The form itself is 3 columns with the first column containing the mngrTasks to be categorized, the second column composed of text entry fields where users input a main category (max 20 characters) and the third column in also composed of text entry fields where the users can input a secondary category (max 20 characters).

Everything displays correctly, and I am allowed to input all of my data. After closing the form I can open the cookie and see that all of the data is stored (approximately 6k with no one cookie larger than 4k). However, when I open the form again it acts like there is no cookie! It doesn’t even “read” the mRdm cookie (first cookie) to see that the user has been there before. If I enter any new data, then the old cookie is overwritten with the new cookie information.

Has anyone else had this issue where the form can no longer “see” the cookie after the cookie grows past a certain size? As long as I keep the size of all the cookies around 4k everything seems to work ok. Is the 4k limit for all cookies total or per cookie??

Thanks in advance!! I am happy to share the code, just didn’t know if it would help.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JMar 22.2006 — I have just run a few tests.

I saved 2 cookies both in excess of 4kb.

Both cookies were writen to the same cookie document which only show a file size of 5kb in the cache

When recalled non of the saved data was shown from either cookie.

When I reduced the cookies size so that together they did not exceed 4kb each cookie showed the relevant data.

Hope this helps
Copy linkTweet thisAlerts:
@lbw8lrrhauthorMar 22.2006 — Thanks, Mr. J, for your quick response. Apparantly what I read on the web about using multiple cookies to exceed the 4k doc size was incorrect [URL=http://codepunk.hardwar.org.uk/ajs36.htm]http://codepunk.hardwar.org.uk/ajs36.htm[/URL] or else I misread it. Do you know if there is a way to save/read cookies from the same page to two different files in order to get around the 4k limit?

Thanks again!
Copy linkTweet thisAlerts:
@felgallMar 22.2006 — I think there is one browser where the programmers misunderstood the cookie rules and built in a 4k per page limit but for most browsers you can have upt to 4k per cookie, up to 20 cookies per site and up to 310 cookies total.
Copy linkTweet thisAlerts:
@Mr_JMar 23.2006 — I just ran my cookie test through mozilla and did find that saving the two cookies of 4kb worked ok.

When I increased one of the cookies to over 4kb only data up to 4kb was retrieved.

As felgall has pointed out it does appear that IE has a limit of 4kb [U]per cookie document[/U]

Although data over 4kb is actually saved to the IE cookie document it renders the cookie document useless and will not retrieve any data even from other cookies in the document.

Other browsers allow 4kb [U]per cookie[/U]
Copy linkTweet thisAlerts:
@lbw8lrrhauthorMar 23.2006 — Thank you Felgall and Mr J for responding to my question! Figures it is an IE thing...long live Firefox!!
×

Success!

Help @lbw8lrrh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...