I got a call today about one of my applications not running correctly from inside an iFrame. I tried it out and it looked like everything worked great in Safari and Firefox but not IE6 or IE7. It took me a few failed attempts to fix it before I decided it must be a session problem. After firing up a packet sniffer it became obvious the cookie with the session ID was not being passed.
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.
PHP:
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
ASP.NET:
HttpContext.Current.Response.AddHeader("p3p","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
Django:
response = render_to_response('mytemplate.html') response["P3P"] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
JSP:
response.addHeader("P3P","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"")
Comments
Anonymous (not verified)
Thu, 02/10/2011 - 11:59
Permalink
Thanks a lot !
Spent 5 hours on that, 3 to find the origin (P3P), 2 to read the "boring" spec to finally try a big google request which led to your excellent and concise article ! Thanks again.
Anonymous (not verified)
Fri, 02/18/2011 - 12:59
Permalink
amazing!
Great! Lot of time saved!
Anonymous (not verified)
Wed, 03/09/2011 - 08:56
Permalink
Thanks
Good Work, saved me a lot of time.
Anonymous (not verified)
Mon, 04/18/2011 - 12:37
Permalink
IE7 Frame Refresh Bug
Hi Adam,
My problem is much simpler. I am not using iFrames, and the entire "site" is actually on a disk. The frameset consists of two vertical frames, the left of which links to a page that lists navigation links. The right by default links to the Home page. There is only one other page that displays in that frame. The link to that page is in the Nav frame.
There is no code other than HTML and I am not setting any cookies.
When I open up the site, it displays properly, but if I refresh it, then the left nav page displays in both the left nav frame and the body frame. This does not occur in Safari or Firefox, although they behave diffently from each other (Safari refreshes to the default frameloads; Firefox to the current frameloads).
Any assistance would be greatly appreciated.
Thanks!
Ellen
Anonymous (not verified)
Mon, 04/18/2011 - 12:59
Permalink
IE7 Frame Refresh Bug - More
Hi Adam,
I discovered that if I right-click on the right frame and select Refresh, then it refreshes properly. It is only when I refresh the entire frameset that it does not.
Ellen
Anonymous (not verified)
Wed, 04/20/2011 - 08:26
Permalink
Very helpful indeed. I also
Very helpful indeed. I also needed this fix for IE8 and IE9.
Thanks...
Anonymous (not verified)
Mon, 04/25/2011 - 03:00
Permalink
Thanks a lot! It fixed my problem! :)
Thanks a lot! It fixed my problem! :)
Pages