Cookie not being saved in Safari

Any idea why my cookie is saved in IE and Firefox but not Safari?

The code in the form is:

“<META HTTP-EQUIV="Set-Cookie" CONTENT="cartid=” + UniqueNumber + “; expires=” + ExpDate + “; path=/">”

The Web Page Source shows the code is sent to the browser. Safari is even set to “Accept all cookies”.

I know this is probably a Browser issue and not a programming issue but I have been working on this for several days and I am stumped. Any ideas?

Here is an excerpt of the beginning source code from the browser:

Subject: Cookie not being saved in Safari

No reason to use for that anymore, Shawn – use @SetHTTPHeader instead. Safari might not like , but the actual content of the HTTP response header should do the trick.

Subject: RE: Cookie not being saved in Safari

Thank you for the help Stan. I have changed the code to use @setHTTPheader. I am still having the same problem. Safari doesn’t save the cookie from the database/site. Using @setHTTPheader, I looked at the page source code and it does show “1” for the header response. Apparently that does’t necessarily mean that the cookie was saved. It seems like it should be working, but I am obviously missing something.

Subject: RE: Cookie not being saved in Safari

…or Safari is missing something.

Subject: RE: Cookie not being saved in Safari

My experience with Domino and Safari has not been good. This includes Quickplace. I finally just put a browser detect script on all my pages that tells them Safari isn’t supported at this time and to use IE or Firefox. This is not limited to Domino, the Cold Fusion developers at my job are having similar problems. Safari is a nice looking browser, but…

Subject: RE: Cookie not being saved in Safari

I’ve had mixed results in Safari when building sites in Domino and Cold Fusion. It’s very unforgiving. If the html or javascript isn’t exactly what it expects, it will often screw up where other browsers are more forgiving. However, I have a few suggestions.

Try some sites that set cookies and see if they’re successful. If so, try using javascript to set the cookie instead and see if that helps. Or look at the source code of the successful site to see how they’re setting cookies.

If other sites are unable to set cookies also, do the following:

  1. Check to make sure you have the latest version of Safari. If not, download an update. There have been several security patches that have messed me up several times. One of them caused Safari to stop accepting cookies from some sites. The most recent update seems to have stabilized things.

  2. Check the file ~/Library/Application Support/WebFoundation/Cookies.plist. Do a Get Info on it and see if it’s locked. If so, unlock it. If that file is locked, Safari will not accept cookies even if you’ve told it to.

  3. As a last resort, repair disk permissions, especially if you’ve downloaded a security update recently. Bad disk permissions can cause numerous problems.

You can use disk utility, but I usually find it easier to just reboot and hold down Command S as the machine boots up. At the command prompt, type fsck -y and hit return. If you’re using journaling, you’ll need to type fsck -f instead. After the disk permissions are repaired, type reboot and hit return.

Good luck. Coding for browser differences is always frustrating.

Subject: RE: Cookie not being saved in Safari

Interesting… It is working with Javascript. I am not sure why Safari wasn’t saving the cookies with the META data or the @setHTTPheader function, but it is working now with the Javascript.

I know that I am learning that Safari is a pain to design for. What looks good in all other browsers does not seem to render correctly in Safari and I am not sure what to think about this cookie problem.

Anyway, thanks for the help.

Subject: RE: Cookie not being saved in Safari

Thank you for the suggestions. Safari, on the one machine we have here that has OS X, does accept cookies from other sites just not our’s. But, it does accept the session authentication cookie when authenticating on our site. That’s why I thought it might be in the cookie-code I am using.

I am going to try using javascript to see if I get any different results writing the cookie or try to determine if there’s a problem with the OS/Browser.

Thanks again for the suggestions and I will post any updates in my troubleshooting progress.