Results 1 to 11 of 11
  1. #1

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    Question Safari is using the usual cookie quota for all cookies
    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

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,793
    Specs:
    Early 2015 13" rMBP
    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

  3. #3

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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

  4. #4

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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.

  5. #5

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,793
    Specs:
    Early 2015 13" rMBP
    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

  6. #6

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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

  7. #7

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    I put in a sleep command for 1 second - it made no difference.
    Next I am going to disable the third cookie.

  8. #8

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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.

  9. #9

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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.

  10. #10

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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.

  11. #11

    DaveBleasdale's Avatar
    Member Since
    Jun 12, 2012
    Location
    Lancaster, England
    Posts
    11
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Safari and cookies
    By dizzwold in forum OS X - Operating System
    Replies: 2
    Last Post: 11-05-2014, 01:58 PM
  2. Safari Cookies not working quite right...
    By sbatson in forum OS X - Apps and Games
    Replies: 1
    Last Post: 06-13-2012, 06:52 AM
  3. Viewing cookies in Safari
    By malcolmi in forum OS X - Apps and Games
    Replies: 0
    Last Post: 08-09-2011, 06:33 AM
  4. Safari Cookies (Cookie Management)
    By Zanthe in forum OS X - Apps and Games
    Replies: 0
    Last Post: 06-13-2009, 11:40 AM
  5. Cookie Question-Safari
    By calichris in forum OS X - Apps and Games
    Replies: 5
    Last Post: 07-12-2008, 06:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •