Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cookies not setting in Safari 6

Good evening,

I've asked this question a couple of times without responses, hope this time goes well. I've been developing facebook apps for a couple of years now, using php and the Facebook PHP SDK. Lately I've been struggling with Safari and the login with Facebook.

The problem is that Safari 6 has checked by default the "Block 3rd party cookies" option, so my app can't set the cookies automatically. I'm seeing this only in Safari, the cookies are empty, unlike Chrome or Firefox, both are saving cookies well.

I'm logging in the user with the Facebook PHP SDK example, so I don't know where the problem is. I've read a lot of "solutions" but are not up to date and don't work for Safari 6.

Is there a way to set the cookies manually or a trick to tell the browser that this is a secure site?

I don't really know if I'm asking the right question. I'm desperate about this issue, really, I've tried everything and I could use some help, anything would help.

Thank you very much!

like image 886
chuysbz Avatar asked Feb 12 '13 05:02

chuysbz


People also ask

Why is my Mac not enabling cookies?

On a Macbook, open the Safari browser. Click the Safari menu button, found at the top-left corner of the web page, and then click Preferences. Click the Privacy tab. Leave unchecked the Block all cookies tab.

Why are my cookies not enabled?

Enabling cookies in Chrome for Android Go to More menu > Settings > Site settings > Cookies. You'll find the More menu icon in the top-right corner. Make sure cookies are turned on.


2 Answers

have you tried any of these Setting cross-domain cookies in Safari

Safari6 out of box, doesn't allow cross domain cookies which is the problem.

like image 158
Jessie Frazelle Avatar answered Nov 16 '22 22:11

Jessie Frazelle


You can set the cookie manually with php:

setcookie(name, value, expire, path, domain);

http://php.net/manual/en/features.cookies.php

Or is this what you are already using?

Also, try using p3p headers.

<?
  header('P3P: CP=HONK');
  setcookie('test_cookie', '1', 0, '/');
?>
like image 23
Bennett Avatar answered Nov 16 '22 20:11

Bennett