While developing an iFrame Canvas Facebook app recently, I found out that FB iFrame app’s session did not work quite expectantly in IE8. Firefox, Chrome, Safari, Opera all worked as expected but IE8 block access to cookies.
After spending some minutes Googling, I found out that IE8 restricts the access to cookies, known as 3rd party cookies, under some conditions (Default IE config). and this issue is not 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 and to maintain session state, the page issues a session cookie which is stored in the client. If your iFrame webpage or app uses session then it has to be allowed by the browser to store the cookie. In case of IE8, it fails to store the cookie which means session will be lost.
Alright, enough theory.. So what’s the solution?
Add this code at the top of your php page:
header('p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"');
By adding this P3P Compact Privacy Policy header to your page will make IE to accept cookies from different domains.
Hope that helps.
thanks a lot 🙂
I f*ckin love you man 🙂 That shit freaked me out totally until i found your post.