Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
157
rated 0 times [  158] [ 1]  / answers: 1 / hits: 21395  / 12 Years ago, tue, july 24, 2012, 12:00:00

Safari on a Mac has a Block cookies set to From third parties and advertisers by default.



It stops the SharedObject from working if the embedded swf is from a different domain.



This problem isn't new:
Safari 3rd party cookie iframe trick no longer working?



Has anyone found a solution (other then passing the Session ID through GET/POST params in each request)?



NOTE:
I have no access to the site, which is embedding the swf, so there is no way to alter that HTML or to put any JavaScript, etc.


More From » facebook

 Answers
16
function setCookie(){
if ( navigator.userAgent.indexOf('Safari') != -1 &&
navigator.userAgent.indexOf('Chrome') == -1 ){
window.open('safari.php','','width=200,height=100' );
}
}

// then we set the cookie in safari.php


Source: http://www.reizbombardement.de/archives/safari-5-1-4-enforces-cookie-policy



//UPDATE 23 July 2013



This crappy way of fixing this issue used to work until Safari 6.



Please see @Fabio Antunes and @ncubica comments below.



//UPDATE 23 July 2013 by Fabio Antunes



Here's my code



On the landing page we'll have a brief description about the app and a button saying something like enter. I'm using jquery to simplify this process, creating a listener for the click event, I'll just put the javascript code, since I'm assuming you already have the rest of the html code for the landing page:



$(document).on(click, #bt-landing, function(){
var left = (screen.width/2)-(500/2);
var top = (screen.height/2)-(250/2);
window.open('URL_FOR_THE_PHP_THAT_WILL_CREATE_THE_SESSION', '_blank', 'width=500,height=250,toolbar=0,location=0,menubar=0, top='+top+', left='+left);
});


This you'll open a small window, with 500 by 250 px, centered on your screen.



The code I have for the small window is this:



<?php setcookie(safari_cookie, 1);?>
<html>
<head>
<meta charset=utf-8>
<title>THE NAME OF YOUR APP OR SOMETHING THAT THE USER WE'LL READ AND ASSUME THAT THIS SMALL WINDOW IS RELIABLE</title>
</head>
<body>
<script type=text/javascript>
$(document).ready(function(){
setTimeout(function(){window.close()},1000);
})
</script>
</body>
</html

[#84066] Sunday, July 22, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hakeemabramh

Total Points: 234
Total Questions: 109
Total Answers: 109

Location: Romania
Member since Mon, Jun 6, 2022
2 Years ago
hakeemabramh questions
;