« Solution for no vibration on iPhone 3GSLink exchange concept »

P3P fix for Internet Explorer to access cross domain cookie in iframe

Technical, PHP, 197 words   English (AU) Bookmark and Share

I had an issue whereby my iframe was loading a webpage from a different domain. Problem is the webpage in the iframe was required to load cookies from its own domain. This works in Firefox and most other browsers except Internet Explorer because its default setting prevents the loading of 3rd party. Google says that all you need to do to get this working is setup a P3P Cookie Privacy policy according to P3P Specifications. Most results also say that all you need is to setup the P3P policy in the header. Such as in VB

Code:

HttpContext.Current.Response.AddHeader("P3P", "CP=""CAO PSA OUR""")

OR in PHP

PHP:

<?php header('P3P: CP="CAO PSA OUR"'); ?>

...

If you check with the P3P validator, this fails because its does not have a valid xml policy. Turns out that adding to the header is actually a compact policy hence does not need an xml policy as needed by the validator.

Still doesn’t work?

If you’ve set the headers as follows then its working, all you need to check is that you have the same P3P headers added to page where the cookies are set even though the page that sets the cookie isn’t in the iframe.

Trackback address for this post

This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)

2 comments

Comment from: Christopher Terry [Visitor] Email
Christopher TerrySo, Where do I put this item in my code? In the VB/C#, or in the iframe?
03/11/10 @ 13:28
Comment from: Brinley Ang [Member] Email
Brinley AngYou put the code in the VB/C# just before the cookie is set which may or may not be in the iframe.
03/11/10 @ 17:15

Leave a comment


Your email address will not be revealed on this site.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)
February 2012
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        
Brinley Ang

Brinley Ang is a sysadmin, web dev, coder, geek boy, jedi knight fragger, caffine addict, deaf meloncholic and rockstar wannabe. Listens to the sex pistols and a wide assortment of heavy metal.

Make payments with PayPal - it's fast, free and secure!
Search
home | portfolio | blog | links | contact
© 2012 - Brinley Ang
Valid xhtml