IE Blocking iFrame Cookies

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

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.

amazing!

Great! Lot of time saved!

Thanks

Good Work, saved me a lot of time.

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

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

Very helpful indeed. I also

Very helpful indeed. I also needed this fix for IE8 and IE9.

Thanks...

Thanks a lot! It fixed my problem! :)

Thanks a lot! It fixed my problem! :)

Pages