Forums

  • Home
  •  » FAQ
  •  » iframe Applications and P3P HTTP Headers

#1 2007-10-22 17:52:35

anatolyl
_Moderator_
From: Israel
Registered: 2007-10-16
Posts: 3782
Website

iframe Applications and P3P HTTP Headers

Q: Why "make sure to implement P3P if using iframes" ?

A: If your application is inside iframe with parent belongs to another domain - cookies will not work for some very common configurations for example IE 6/7 with privacy set to medium. If cookies don't work - session won't work.

Therefore session state turns out useless for your application under Internet Explorer. See - Privacy in Internet Explorer 6.


Solution - need to implement P3P header to tell the browser that cookies for your application inside iframe are OK for user privacy.


So, ASP.NET implementation may look like the following (global.asax):


Code:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
    //
    HttpContext.Current.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\"");
}

Anatoly Lubarsky

Offline

 

#2 2008-01-01 20:39:01

mt217
Member
Registered: 2008-01-01
Posts: 33
Website

Re: iframe Applications and P3P HTTP Headers

How would you do this in PHP?

Offline

 

#3 2008-01-22 15:00:16

feliphe
Member
From: Boston MA
Registered: 2007-12-03
Posts: 647
Website

Re: iframe Applications and P3P HTTP Headers

Thank you for this post, i use the php version.... I was getting nuts

Online

 

#4 2008-03-10 23:05:24

webjoe
Member
From: Los Angeles
Registered: 2007-10-29
Posts: 13
Website

Re: iframe Applications and P3P HTTP Headers

For PHP - its:

Code:

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

Oops  - didn't see someone posted already.

Last edited by webjoe (2008-03-10 23:06:01)


Sometrics - Analytics for your App!
www.sometrics.com

Chat Live! M-F 10A-7PM

Offline

 

#5 2008-08-29 12:45:39

letmesaymmmm_
Member
From: B E R M U D A
Registered: 2008-08-29
Posts: 8
Website

Re: iframe Applications and P3P HTTP Headers

helpful..


i lead the rest will follow

Offline

 

#6 2008-11-17 10:34:51

Lethos
Member
From: Northampton, England
Registered: 2008-05-26
Posts: 590
Website

Re: iframe Applications and P3P HTTP Headers

Thanks, I was thinking of adding in my own forum, inside the App, which would require the use of Sessions/cookies, so this would help with any potential problems.

CB
Battlelords

Last edited by Lethos (2008-12-13 16:57:47)

Offline

 

#7 2008-11-17 10:57:43

judomaster2000
Member
Registered: 2008-11-06
Posts: 4

Re: iframe Applications and P3P HTTP Headers

What about cookies in safari?

I have tried (unsuccessfully) to set a cookie in safari in javascript in an IFrame application. I am unsure if this is even possible on their default cookie settings.

If you are running safari and you set the src of an iframe to this url: http://developer.apple.com/internet/saf … ml#anchor6 and click "get cookies" it will give you "no cookies" as a result.  Even if you "navigate" to the page (click through a link to that page in the iframe first) you will still not get a cookie. Their docs say this should be possible... but it isnt.

Anyone know a way around this?

Offline

 

#8 2008-11-17 14:02:57

anatolyl
_Moderator_
From: Israel
Registered: 2007-10-16
Posts: 3782
Website

Re: iframe Applications and P3P HTTP Headers

judomaster2000 wrote:

What about cookies in safari?

I have tried (unsuccessfully) to set a cookie in safari in javascript in an IFrame application. I am unsure if this is even possible on their default cookie settings.

If you are running safari and you set the src of an iframe to this url: http://developer.apple.com/internet/saf … ml#anchor6 and click "get cookies" it will give you "no cookies" as a result.  Even if you "navigate" to the page (click through a link to that page in the iframe first) you will still not get a cookie. Their docs say this should be possible... but it isnt.

Anyone know a way around this?

try to use cookieless sessions.


Anatoly Lubarsky

Offline

 

#9 2008-11-26 07:37:52

ncutler
Member
Registered: 2008-09-06
Posts: 23

Re: iframe Applications and P3P HTTP Headers

Safari has always given me issues in authorization of the facebook process (just trying to return the uid).

Has anyone got any solutions yet?


Developer of Ballistic Combat

Offline

 

#10 2009-02-06 10:16:17

MissDanni
Member
Registered: 2009-02-06
Posts: 14

Re: iframe Applications and P3P HTTP Headers

Its getting crazy with all the various browsers out there, but I guess nothing is any fun without a challenge.

Offline

 

#11 2009-05-21 23:35:46

iah
Member
Registered: 2009-05-21
Posts: 1

Re: iframe Applications and P3P HTTP Headers

I'm trying run an application  as an iframe inside another facebook application. The iframe will display friend's list of the user who authorized the parent application.  How can use parent frame's api key to initiate the child frame and display the user's friend in the iframe.

Offline

 

#12 2009-07-08 12:35:42

SayNate
New Member
From: New York
Registered: 2009-07-08
Posts: 2

Re: iframe Applications and P3P HTTP Headers

I just finished an exhausting 2 hour cram on P3P and IE madness. Here is what I discovered and added to our iframed apps to comply with IE's privacy settings.


Article - good overview

http://www.softwareprojects.com/resourc … -1612.html


P3P Editor - IBM tool to create the "compact privacy policy" that IE requires

http://www.alphaworks.ibm.com/tech/p3peditor

Just download the JAR file and run the following command. You will of course need Java installed. This should work on any OS that supports Java. Use their templates to get started. You can save and edit for different sites. Very useful. Oh and free.

java -jar p3p.jar


Example - This is how Yahoo has it setup even though they're not dealing with FB iframe issues presumably.

HTTP header included in all HTTP requests made using IE 6+

P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HE

Referenced P3P XML file

http://info.yahoo.com/w3c/p3p.xml which redirects to http://info.yahoo.com/privacy/w3c/p3p_policy.xml


Server Configuration - Easiest way is to setup Apache to add P3P header to all HTTP calls made from an IE browser

Add the following to your httpd.conf file within <VirtualHost> settings. More about that here http://httpd.apache.org/docs/2.0/mod/mod_headers.html

BrowserMatch MSIE IS_MSIE
Header set P3P "policyref=\"http://www.your-domain.com/w3c/p3p.xml\", CP=\"CAO DSP CURa ADMa DEVa TAIa PSAa PSDa IVAi IVDi CONi OUR UNRi OTRi BUS IND PHY ONL UNI COM NAV INT DEM CNT STA PRE GOV LOC\"" env=IS_MSIE

The value of the CP portion can be generated using IBM's tool (link above)

Hope this helps. With this setup you'll be able to set cookies and use cookie-based session management even when IE is set to use highest privacy settings (Medium are the default)

Offline

 

#13 2009-07-18 00:59:57

raja546
New Member
Registered: 2009-07-16
Posts: 3
Website

Re: iframe Applications and P3P HTTP Headers

thanx for sharing this info saynate but where is the link dude!

Offline

 

#14 2009-08-10 10:26:59

barisaydiner
New Member
Registered: 2009-08-10
Posts: 3

Re: iframe Applications and P3P HTTP Headers

webjoe wrote:

For PHP - its:

Code:

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

Oops  - didn't see someone posted already.

i tried but it doesn't work for me

where we have to add this code?

Offline

 

#15 2009-08-24 09:35:59

OooOCam
New Member
Registered: 2009-08-24
Posts: 2

Re: iframe Applications and P3P HTTP Headers

Got similar problem the other day and after searching online, get it sorted, but Safari still not accept cross domain cookie sad Never mind...

I also generated our own P3P compact policy as we need it for a production site, so I will share my experience here :-)

I can't find a free online generator, so I downloaded the IBM one http://www.alphaworks.ibm.com/tech/p3peditor/ which is free. Quite easy to use. Unzip the p3pExecutableJar and execute the p3p.jar to load up the software.

You can create a new policy from scratch or create one from one of the templates which I found is easier.
From quick start, select create from template, I use the 'Acccess logging & user tracking' template. Click Ok, then just need to fill in global policy properties such as company informations etc, then a privacy policy html and compact policy text will be auto generated. You can then use the compact policy on the header.

If you need more detailed explaination, please refer the KnowledgeGene I wrote which has step on step guides:
http://www.knowledgegenes.com/home.aspx … amp;nid=52
http://everydayopenslikeaflower.blogspo … ement.html

Hope this is helpful smile

Offline

 

#16 2009-09-07 07:25:53

Joshspyker
New Member
Registered: 2009-09-03
Posts: 20

Re: iframe Applications and P3P HTTP Headers

I tried using the PHP code but with no success..  I guess something went wrong again.. sad

Offline

 

#17 2009-09-17 00:45:22

nike25
Member
From: Cochin
Registered: 2009-06-03
Posts: 39

Re: iframe Applications and P3P HTTP Headers

im using facebook connect in a website.. i didnt get the facebook connect in IE when i invoke FB.Connect.requireSession()..

but when i refresh it manually for one or more times the popup will comes out..

i thk may be the session is not getting in first time in IE..(all thing happens only in IE and chrome)

do we add some more codes for working it perfect..??


john davis - PHP web applications

Offline

 

#18 2009-10-08 16:35:30

humeniuc
New Member
Registered: 2009-10-08
Posts: 1

Re: iframe Applications and P3P HTTP Headers

I try to make an iframe application, with php on the server side.
Authentication to facebook from php works fine, and after I set the p3p header (a few combinatons) cookies are setted ok in IE8. If I try to start FB connect on the client side, I have discovered that my cookies dissapered.
After some tests I have observed that cookies that come from server are actualy ok, but any try to change them from javascript, result in cookie loss.

Anybody know how to solve this issue?

Offline

 

#19 2009-10-15 09:11:05

buckyuk
Member
Registered: 2008-11-30
Posts: 4

Re: iframe Applications and P3P HTTP Headers

I've no idea Humeniuc,
I cant get the PHP code working either... sorry about this, but should the PHP code be added in the header?

Offline

 

#20 2009-11-01 22:52:48

RajeshPhoton
New Member
Registered: 2009-10-30
Posts: 3

Re: iframe Applications and P3P HTTP Headers

Me to pesrsists the similar kind of problem ..
We developed an xajax based php framework apps and hosted it to facebook apps. For that we used facebook iFrame.
I have a problem in this.My application is loading quiet good in iframe of facebook at the instance and the xajax is working great.
But when I used xajax request and reload my application then I find the following error thrown
This XML file does not appear to have any style information associated with it. The document tree is shown below.     

<xjx>

<cmd cmd="as" id="whatisaycontainer" prop="innerHTML">
S<table id='whatisay' border=0 cellpadding=0 cellspacing=0>
<tr><td valign='top'><input type='checkbox' name='whatsay1' id='whatsay1' value='Hang in there.'  onclick='ToggleMessage(this);BuildPreview();'></td><td class='brown' >Hang in there.</td></tr><tr><td valign='top'><input type='checkbox' name='whatsay2' id='whatsay2' value='I believe in you.'  onclick='ToggleMessage(this);BuildPreview();'></td><td class='brown' >I believe in you.</td></tr><tr><td valign='top'><input type='checkbox' name='whatsay3' id='whatsay3' value='I know its a rough patch right now..'  onclick='ToggleMessage(this);BuildPreview();'></td><td class='brown' >I know its a rough patch right now..</td></tr><tr><td valign='top'><input type='checkbox' name='whatsay4' id='whatsay4' value='Chin up, you!'  onclick='ToggleMessage(this);BuildPreview();'></td><td class='brown' >Chin up, you!</td></tr><tr><td valign='top'><input type='checkbox' name='whatsay5' id='whatsay5' value='Are you feeling better about life?'  onclick='ToggleMessage(this);BuildPreview();'></td><td class='brown' >Are you feeling better about life?</td></tr><input type='hidden' name='maxwatsay' value='6'></table>
</cmd>

<cmd cmd="jc" func="AlignCheckboxes">
<xjxobj/>
</cmd>
</xjx>
I am cracking my head and debugged all possible chances 1. Loops 2. Header info 3. Iframe of facebook on the top etc.. I checked my programming and find no problem with any reference call.

So this is also related to kind of xajax REQUEST headers problem..Request anyone here can help me solve this out ..

Offline

 
  • Home
  •  » FAQ
  •  » iframe Applications and P3P HTTP Headers

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson