The ProblemApple's Safari web browser is configured to block third-party cookies by default, unless the user has had prior interactions with the third-party domain:
The SolutionThe idea is simple, just make sure the user visits the iframe domain (in this example, B.com) at least once.
One way is to run a popup that visits B.com (and set the P3P header), then close the popup.
On the parent window:
var win = window.open('http://B.com/startsession.php', '_blank', 'height=200,width=150');
win.close(); // close it after 1 second :)
Then in the startsession.php, just set the header will do
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');