Safari is using the usual cookie quota for all cookies

Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
Hi

I am trying to store some user preferences for a website in a cookie. The amount of info I want to store exceeds what is allowed in one cookie (even after compression). So I split the info over two cookies.

IE, FF and Chrome are happy enough, but Safari appears to NOT be setting the second cookie when the size of the info exceeds the limit for one cookie.

Confused? So was I. I did tests. The info in the first cookie works fine. The second cookie contains about seven lines. I commented out various lines looking for rogue data. Eventually I found that with ANY two of the lines of the data 'live' (and the others commented out) the cookie would be set, but when I added any third line - the cookie would not set.

Has this happened to any one else?

I could reduce the amount of data stored, but that will require queries in a PHP forum!

Dave
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
How much data are you storing? I only ask since cookies are really only meant to store limited amounts of data. Perhaps localStorage might be a better option.

Can you provide us with some relevant sample code and results?
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
van

Thanks for your reply.

I don't how much exactly, but I know it was exceeding the limit because it wasn't working in IE and Google Chrome and FF so I split it up.

The data is,
shortname, shortname with spaces, long name, status, web link for 18 options. I have started splitting the data into two arrays (only name and status really need to be saved in a cookie) but as I hinted at in the question I am going to have to rewrite the PHP to link the two data sets.

The code is long and complex and I am not really expecting people to drag through it. I was hoping that someone had run into the same issue or new of a bug/syndrome that was causing the bother.

Dave
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
I have found that:
- cookie 1 is 3442 bytes
- cookie 2 is 1744 bytes (this cookie doesn't read)
- the cookies were set at the same time
- another unrelated cookie - 10 bytes
- total: 5196 bytes
- Safari is not reading the second cookie correctly - it sets but doesn't read
- it doesn't matter which order or which code is used - the affect is the same.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Try reading just the second cookie on a test page, ignoring the first one altogether. I wonder if the second cookie is being improperly set.
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
Good test - the second cookie does now work in Safari

I think that it may be a timing error - the cookies are set too close together and one corrupts the other. If I inserted a command between the two cookie set commands that wasted some time it might help. OR if I moved some unrelated useful code between the two cookie sets.

Thanks, Dave
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
I put in a sleep command for 1 second - it made no difference.
Next I am going to disable the third cookie.
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
I can't seem to remove the third cookie.
- I disable the code that creates.
- I remove it.
- it reappears
It contains the name of css file that controls the colour and is plain text.
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
I have added dummy cookies:
- a duplicate of the working cookie (with different name) disables the previosly working cookie
- an additional dummy cookie containing one word leaves the situation as is.
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
I have done the following:
- added the Windows version of Safari to my Windows 7 PC - it has the same issue as the Mac version.
- done more tests by removing lines of data - I have 18 lines of data - I have been remove lines from both cookies - it seems that I am 'allowed' 14 lines of data in both cookies - the split could be 12/2 or 11/3 or 7/7.

It would seem that I have found a 'read' quota limit for all cookies in Safari.
 
OP
DaveBleasdale
Joined
Jun 12, 2012
Messages
11
Reaction score
0
Points
1
Location
Lancaster, England
Van

I have sorted out the issue by reducing the size of the cookie. This was the right thing to do but leaves the safari issue somewhat unresolved. What I haven't is devise a test that proves that the is a size limit on all cookies in a safari session which just a little larger than the limit for one cookie.

Thanks for your help.

Dave
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top