New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Safari is using the usual cookie quota for all cookies


Post Reply New Thread Subscribe

 
Thread Tools
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,757
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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?

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,757
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
I put in a sleep command for 1 second - it made no difference.
Next I am going to disable the third cookie.
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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.
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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.
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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.
QUOTE Thanks
DaveBleasdale

 
DaveBleasdale's Avatar
 
Member Since: Jun 12, 2012
Location: Lancaster, England
Posts: 11
DaveBleasdale is on a distinguished road

DaveBleasdale is offline
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
QUOTE Thanks

Post Reply New Thread Subscribe


« iWeb and photo corrections and importing | web content to hard drive »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Safari Cookies not working quite right... sbatson OS X - Apps and Games 1 06-13-2012 05:52 AM
.11 update issues KB3GZW OS X - Operating System 36 11-24-2007 02:45 PM
Saving Cookies on Safari menno OS X - Apps and Games 4 01-31-2007 09:51 AM
Safari won't accept any cookies? edokid Switcher Hangout 3 01-22-2005 11:52 AM
Safari / Cookies from local files applebill Web Design and Hosting 0 11-04-2004 12:04 PM

All times are GMT -4. The time now is 04:54 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?