Session cookies in IFRAME for IE 6/7

300 views
Skip to first unread message

Nikhil Gupte

unread,
Apr 22, 2008, 11:11:10 AM4/22/08
to Orkut Developer Forum
Hi,

I'm not able to store session cookies in an IFRAME when using IE 7.
I've googled on this and got info about P3P and compact privacy
headers. The headers got the cookies working with IE 6 but not with IE
7. I've even tried several options with the p3p.xml and privacy.xml
settings with no luck.

If anyone has tackled this issue, pl. let me know how.

Thanks.

BuboMe

unread,
Apr 23, 2008, 6:19:28 PM4/23/08
to Orkut Developer Forum
Hello,
hm.. seems a bit strange, adding a P3P header should just work.
I use Coldfusion, and there's only one line of code for that:
<cfheader name="P3P" value='CP="CAO PSA OUR"'>

and it does all the magic, works prefectly fine in IE 6 and 7, and FF.

Ed

Rohit Ghatol (Google)

unread,
Apr 24, 2008, 12:31:02 AM4/24/08
to Orkut Developer Forum
Hi Nikhil,

I tried this using the following "P3P" header value for my iframe and
this worked fine in IE7. IE7 allowed the nested Iframe to create the
cookies.
CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"

Please find the url of my P3P Test Gadget below and also find below
the JSP code snippet which is loaded in the nested iframe. You can
yourself test out this gadget on IE7
http://hosting.gmodules.com/ig/gadgets/file/117096175175119497472/p3p.xml

Regards,
Rohit

NestIframeJSP.jsp -->
<%
response.setHeader("P3P","CP=\"ALL ADM DEV PSAi COM OUR OTRo STP IND
ONL\"");
%>
<HTML>
<HEAD>
<script>
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return
c.substring(nameEQ.length,c.length);
}
return null;
}
</script>
</HEAD>
<BODY>

<%
session.setAttribute("name","value" );
out.println("Server created the JSESSIONID cookie by creating a
session.");
%>
<hr/>
Running javascript to retrieve these cookies <div
id="placeholder"></div>
<script>
document.getElementById("placeholder").innerHTML="JSESSIONID's
value is "+readCookie('JSESSIONID');
</script>

</BODY>
</HTML>


On Apr 22, 8:11 pm, Nikhil Gupte <nikhilgu...@gmail.com> wrote:
> Hi,
>
> I'm not able to store session cookies in an IFRAME when using IE 7.
> I've googled on this and got info aboutP3Pand compact privacy
> headers. The headers got the cookies working with IE 6 but not with IE
> 7. I've even tried several options with thep3p.xml and privacy.xml

Nikhil Gupte

unread,
Apr 24, 2008, 3:56:51 AM4/24/08
to Orkut Developer Forum
Thanks guys. The problem I had seemed to be with a particular
combination of Apache (2.2) + mongrel. For some reason, IE7 ignored
the P3P header. Didn't have the problem if I used mongrel directly or
behind nginx. Still don't know why it happened, but for now nginx
+mongrel seems to work well with IE7.

On Apr 24, 9:31 am, "Rohit Ghatol (Google)"
<api_rohitgha...@google.com> wrote:
> Hi Nikhil,
>
> I tried this using the following "P3P" header value for my iframe and
> this worked fine in IE7. IE7 allowed the nested Iframe to create the
> cookies.
> CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
>
> Please find the url of my P3P Test Gadget below and also find below
> the JSP code snippet which is loaded in the nested iframe. You can
> yourself test out this gadget on IE7http://hosting.gmodules.com/ig/gadgets/file/117096175175119497472/p3p...
Reply all
Reply to author
Forward
0 new messages