nazly.me

Weblog of Nazly Ahmed

Nazly Ahmed

Nazly Ahmed

Web Developer. PHP Addict. Wordpress Hacker. FOSS Enthusiast. (Micro)Blogger. Photo Hobbyist. Cricket Fanatic. Husband. Dad.

Recently I was developing a Facebook iframe application using PHP and all was good until I got few complaints that the application wasn’t functioning as it’s supposed to on IE8. I was using the Facebook php-sdk and I have tested this app successfully on Firefox 4 and Google Chrome 11. Since I was on a Ubuntu box, I tested the app on IE6 under wine and I didn’t have any issues as such. I had to get a help from a friend using Windows and IE8 to dig deep into the problem. The issue seemed that session data didn’t persist across the application specifically on IE8.

After more research, I realized that this problem isn’t specific to Facebook, but iframes. Since the iframe was loading a web page from a different domain, IE8’s default settings prevented loading of 3rd party cookies. To get this working, I had to setup a P3P Cookie Privacy Policy according to P3P Specifications. In PHP, this can be done by sending this header on top of the script.

<?php
header('P3P: CP="CAO PSA OUR"');
?>

That’s it. All problems automagically solved..

Posted on 24th June 2011 21:06:31