Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iframe not working in IE; session/login issue?

I have an issue with my Facebook canvas iframe application.

I'm using sessions to build a simple questionnaire-style application. There's a question on each page, when the form is submitted the answer is stored in a session array, and the page number is incremented by one, which then displays the next question. Simple stuff.

This app, however; works in every browser except Internet Explorer.

In Internet Explorer, on page change it appears to go through another page change which invalidates the session, and starts all over again. I've searched and searched, but can't seem to find the cause of this behaviour.

I've placed the source code of the app at http://gist.github.com/613083. The app is using the standard PHP SDK provided by Facebook at http://www.github.com/facebook/php-sdk.

like image 832
Martin Bean Avatar asked Oct 06 '10 09:10

Martin Bean


2 Answers

You might be experiencing a 3rd party cookie issue. If you are caught in a redirect loop this is probably the case.

Solution in php, add this:

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

This cleared it right up for me. I was having a nasty redirect issue.

This allows cross domain cookies to work for the page, as the cookie is being set for Facebook by your iFrame IE has to be told it's ok.

like image 190
Michael Reed Avatar answered Nov 07 '22 18:11

Michael Reed


Quoting from http://adamyoung.net/IE-Blocking-iFrame-Cookies

"The problem lies with a W3C standard called Platform for Privacy Preferences or P3P for short. You can read all about the boring stuff via the link or else just install the P3P Compact Policy header below. This will allow Internet Explorer to accept your third-party cookie. You will need to send the header on every page that sets a cookie."

like image 36
Ari Braginsky Avatar answered Nov 07 '22 16:11

Ari Braginsky