I looked up how to make Facebook apps compatible with IE (Internet Explorer), so here’s a memo.
Facebook apps embedded within Facebook pages work by loading content from a different domain within an iframe.
When loading content from a different domain in an iframe, those cookies become third-party cookies. By default, IE doesn't accept third-party cookies that don't have a policy defined, but they will be accepted if a policy is declared with P3P (www.w3.org).・Source: P3Pコンパクトポリシーをコピペするのが流行らないことを祈る | 水無月ばけらのえび日記 (I Hope Copy-Pasting P3P Compact Policies Doesn’t Become Popular | Minazuki Bakera’s Shrimp Diary)
In the case of IE, the default setting is "don't accept third-party cookies that don't have P3P compact policy defined", so with Facebook apps, you might encounter the phenomenon where it works fine in Firefox and Chrome but doesn't work in IE for some reason.・Source: FacebookアプリのCookieがIEで無効になってしまう現象を回避する方法 - でぶぬる日記 (How to Avoid the Phenomenon of Facebook App Cookies Being Disabled in IE - Debnuru Diary)
The solution is to simply output the specific policy content in the response HTTP header.
■ Ruby on Rails
# application_controller.rb
before_filter :ie_p3p_fix
def ie_p3p_fix
response.headers["P3P"] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
end
■ PHP
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
That’s all.
【Reference】
・FacebookアプリのCookieがIEで無効になってしまう現象を回避する方法 - でぶぬる日記 (How to Avoid the Phenomenon of Facebook App Cookies Being Disabled in IE - Debnuru Diary)
・Facebookアプリ作ってて困った事というか、IEでiframe内の別ドメインのページでもクッキーを有効にする方法とか、セキュリティレベルを下げずにCookieを有効にする方法とか - kissrobberの日記 (Troubles Making Facebook Apps, or How to Enable Cookies on Different Domain Pages Within iframes in IE, or How to Enable Cookies Without Lowering Security Level, etc. - kissrobber’s Diary)
・IE/SafariでFacebookアプリの無限reload対策 (Countermeasures for Infinite Reload of Facebook Apps in IE/Safari)
・php - Facebook iframe not working in IE; session/login issue? - Stack Overflow
・session - Facebook app works on all browsers but not IE8 - Stack Overflow
That’s all from the Gemba.