Cookie阻止/未保存在Internet Explorer的IFRAME中

我有两个网站,假设他们是example.comanotherexample.net 。 在anotherexample.net/page.html ,我有一个IFRAME SRC="http://example.com/someform.asp" 。 该IFRAME显示一个表格供用户填写并提交到http://example.com/process.asp 。 当我在自己的浏览器窗口中打开表单(“ someform.asp ”)时,一切正常。 但是, 当我在IE 6或IE 7中加载someform.asp作为IFRAME时,example.com的cookie不会被保存。 在Firefox中,这个问题不会出现。

出于testing目的,我在http://newmoon.wz.cz/test/page.php上创build了一个类似的设置。

example.com使用基于cookie的会话(而且我无能为力),所以没有cookies, process.asp将不会执行。 如何强制IE保存这些cookie?

嗅探HTTPstream量的结果:在GET /someform.asp响应中,有一个有效的每会话Set-Cookie头(例如Set-Cookie: ASPKSJIUIUGF=JKHJUHVGFYTTYFY ),但在POST /process.asp请求上,没有Cookie头在所有。

编辑3:一些AJAX +服务器端脚本显然能够避开这个问题,但是这看起来非常像一个bug,再加上它会打开一个全新的安全漏洞 。 我不希望我的应用程序使用bug +安全漏洞的组合,只是因为它很容易。

编辑: P3P的政策是根源 ,下面的全面解释。

我得到它的工作,但解决scheme有点复杂,所以忍受我。

发生了什么

实际上,Internet Explorer对IFRAME页面的信任程度较低(IE称为“第三方”内容)。 如果IFRAME中的页面没有隐私政策,则其Cookie被阻止(状态栏中的眼睛图标表示,当您点击该图标时,会显示阻止的URL列表)。

邪恶之眼http://stuff.piskvor.org/cookies_blocked_MSIE_eye.png

在这种情况下,当cookie被阻塞时,会话标识符不会被发送,并且目标脚本会抛出“找不到会话”错误。

(我已经尝试将会话标识符设置到表单中,并从POSTvariables中加载它, 这是行得通的 ,但出于政治原因,我不能这么做)。

可以使IFRAME 内部的页面更可信: 如果内部页面发送带有IE可接受的隐私策略的P3P头部,则cookie将被接受

如何解决它

创build一个p3p策略

一个好的起点是W3C教程 。 我已经完成了它,下载了IBM隐私策略编辑器,并在那里创build了一个隐私策略的表示,并给了它一个名字来引用它(这里是policy1 )。

注意 :在这一点上,您实际上需要确定您的网站是否有隐私政策,如果没有,则创build它 – 无论是收集用户数据,数据types,使用情况,访问权限,等等你需要find这个信息并考虑一下。 只是把几个标签贴在一起不会割掉它。 这一步不能纯粹用软件来完成,而且可能是高度政治性的(例如,“我们应该出售我们的点击统计数据吗?”)。

(例如,“该网站由ACME有限公司运营,它使用匿名的每会话标识符进行操作,只有在明确允许的情况下才收集用户数据,仅用于以下目的,数据仅在需要时才存储,只有我们的公司可以访问它等等“)。

(使用此工具进行编辑时,可以查看策略中的错误/遗漏,“HTML策略”选项卡非常有用:在最下方,它具有“策略评估” – 快速检查策略是否被阻止通过IE的默认设置)

编辑器导出到.p3p文件,这是上述策略的XML表示forms。 此外,它可以导出此政策的“紧凑版本”。

链接到政策

然后需要一个策略引用文件( http://example.com/w3c/p3p.xml )(网站使用的隐私策略索引):

 <META> <POLICY-REFERENCES> <POLICY-REF about="/w3c/example-com.p3p#policy1"> <INCLUDE>/</INCLUDE> <COOKIE-INCLUDE/> </POLICY-REF> </POLICY-REFERENCES> </META> 

<INCLUDE>显示将使用此策略的所有URI(在我的情况下是整个站点)。 我从编辑器导出的策略文件已上传到http://example.com/w3c/example-com.p3p

发送带有响应的紧凑标题

我已经在example.com上设置了web服务器来发送紧凑的头文件,如下所示:

 HTTP/1.1 200 OK P3P: policyref="/w3c/p3p.xml", CP="IDC DSP COR IVAi IVDi OUR TST" // ... other headers and content 

policyref是策略引用文件的相对URI(反过来引用隐私策略), CP是紧凑的策略表示。 请注意,示例中的P3P标头组合可能不适用于您的特定网站; 您的P3P标题务必真实地代表您自己的隐私政策!

利润!

在这个configuration中,邪恶的眼睛不会出现,即使在IFRAME中cookie也被保存,并且应用程序工作。

编辑:除非你喜欢从法律诉讼中辩护,否则不要做

有几个人build议“只是把一些标签放到你的P3P标题中,直到邪恶的眼睛放弃”。

标签不仅仅是一堆,它们具有真实的世界意义 ,它们的使用给你真正的世界责任

例如,假设你从不收集用户数据可能会使浏览器感到高兴,但是如果你实际收集用户数据,则P3P与现实冲突。 简单而简单, 你有意向用户撒谎 ,这可能是一些国家的犯罪行为。 如在“入狱,不要收200美元”。

几个例子( 见全套标签的p3pwriter ):

  • NOI :“网站不收集标识的数据”。 (只要有任何定制,login或任何数据收集(*****分析,任何人?),您必须在您的P3P中承认)
  • STP :保留信息以达到规定的目的。 这就要求信息在尽可能早的时候被丢弃。 网站必须有保留政策,build立销毁时间表。 保留策略必须包含在网站的可读隐私策略中,或者链接到该网站的可读隐私策略。“(因此,如果您发送STP但没有保留策略,那么您可能会犯下欺诈行为,这是多么的酷?

我不是律师,但我不愿意上法庭,看看P3P标题是否真的具有法律约束力,或者如果您能够向您的用户承诺任何事情,却不愿意兑现承诺。

我花了很大一部分时间来看看这个P3P的事情,我觉得有必要分享我发现的东西。

我注意到P3P的概念已经过时了,似乎只能被Internet Explorer(IE)真正使用/强制执行。

最简单的解释是:IE希望你定义一个P3P标题,如果你正在使用cookies。

这是一个不错的主意,幸运的是大多数时候不提供这个头文件不会导致任何问题(读取浏览器警告)。 除非您的网站/networking应用程序使用(i)框架加载到其他网站。 这是IE在***中变成巨大痛苦的地方。 除非设置了P3P标题,否则不允许您设置Cookie。

知道这一点,我想find以下两个问题的答案:

  1. 谁在乎? 换句话说,如果我在标题中加上“土豆”一词,我可以被起诉吗?
  2. 其他公司做什么?

我的发现是:

  1. 没人在乎。 我无法find一个表明这项技术具有任何法定权重的文件。 在我的研究过程中,我没有发现世界各地的一个国家采取了一项法律,防止您在P3P标题中join“土豆”一词
  2. Google和Facebook都在他们的P3P标题字段中提供了一个链接,指向一个页面,描述他们没有P3P标题的原因。

这个概念诞生于2002年,令我感到困惑的是,这种过时的,合法的未实现的概念仍然被IE中的开发者强加于人。 如果这个头文件没有任何合法的分支,这个头文件应该被忽略(或者在控制台中产生一个警告或通知)。 不强制! 我现在不得不在我的代码中插入一行(并向客户端发送一个头文件),这绝对没有任何意义。

简而言之 – 保持IE快乐 – 将下面的代码行添加到您的PHP代码中(其他语言应该看起来类似)

 header('P3P: CP="Potato"'); 

问题解决了,IE对这个马铃薯很满意。

我能够通过简单地将这个小标题添加到IFrame(PHP解决scheme)中的站点来使邪恶的眼睛消失:

 header('P3P: CP="NOI ADM DEV COM NAV OUR STP"'); 

请记住按Ctrl + F5重新加载您的网站或资源pipe理器可能仍然显示邪恶的眼睛,尽pipe事实上,它的工作正常。 这可能是我为什么有这么多问题得到它的工作的主要原因。

没有任何政策文件是必要的。

编辑:我发现了一个很好的博客条目,解释了IFrames中的cookie的问题。 它还可以在C#代码中快速修复: 框架,ASPX页面和拒绝Cookies

我也有这个问题,我想我会发布在我的MVC2项目中使用的代码。 在页面生命周期中添加标题时要小心,否则将得到一个HttpException“ 服务器在发送HTTP标头之后无法追加标头 ”。 我在OnActionExecuting方法(在执行动作之前调用)上使用了一个自定义的ActionFilterAttribute。

 /// <summary> /// Privacy Preferences Project (P3P) serve a compact policy (a "p3p" HTTP header) for all requests /// P3P provides a standard way for Web sites to communicate about their practices around the collection, /// use, and distribution of personal information. It's a machine-readable privacy policy that can be /// automatically fetched and viewed by users, and it can be tailored to fit your company's specific policies. /// </summary> /// <remarks> /// More info http://www.oreillynet.com/lpt/a/1554 /// </remarks> public class P3PAttribute : ActionFilterAttribute { /// <summary> /// On Action Executing add a compact policy "p3p" HTTP header /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpContext.Current.Response.AddHeader("p3p","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""); base.OnActionExecuting(filterContext); } } 

使用示例:

 [P3P] public class HomeController : Controller { public ActionResult Index() { ViewData["Message"] = "Welcome!"; return View(); } public ActionResult About() { return View(); } } 

这是埋在其他答案的评论,但我几乎错过了,所以它似乎是值得自己的答案。

要查看:为了让IE接受第三方cookies,您需要使用名为p3p的http标头来提供您的文件,格式为:

 CP="my compact p3p policy" 

但是,p3p作为一个标准在这一点上已经差不多了,你可以轻松地让IE浏览器工作,而不需要花费时间和法律资源来创build一个真正的p3p策略。 这是因为如果你的紧凑的p3p策略头是无效的,IE实际上将它视为一个好策略并接受第三方cookie。 所以你可以使用这样的p3p头

 CP="This site does not have a p3p policy." 

您可以select包含一个指向页面的链接,解释为什么您没有p3p策略,就像Google和Facebook一样(他们在这里指出: https : //support.google.com/accounts/answer/151657 ,在这里: https ://www.facebook.com/help/327993273962160/ )。

最后,重要的是要注意,从第三方网站提供的所有文件都需要有p3p头文件,而不仅仅是设置cookie的头文件,所以你可能无法在你的PHP,asp.net等码。 你可能更好的设置在networking服务器级别(即在IIS或Apache)。

这是一个关于这个问题的重要话题,但是我发现一个重要的细节(至less在我的情况下是至关重要的)没有发布在这里或其他任何地方(我很抱歉,如果我错过了)是P3P线必须是通过从第三方服务器发送的每个文件的头文件,甚至没有设置或使用Cookie文件,如JavaScript文件或图像的文件。 否则,Cookie将被阻止。 我在这里有更多的这篇文章: http : //posheika.net/?p=110

一个可能的做法是将域名添加到允许的网站工具 – >互联网选项 – >隐私 – >网站:somedomain.com – >允许 – >确定。

任何人在node.js中都有这个问题

然后添加这个p3p模块,并在中间件上启用这个模块。

 npm install p3p 

我使用快递,所以我把它添加到app.js

首先在app.js中需要该模块

 var express = require('express'); var app = express(); var p3p = require('p3p'); 

然后用它作为中间件

 app.use(p3p(p3p.recommended)); 

它会在res对象上添加p3p头文件。 不需要做任何额外的事情。

您将获得更多信息:

https://github.com/troygoode/node-p3p

如果有人正在寻找Apache线路; 我们用这个。

标题设置P3P“CP = \”感谢IE8 \“”

只要有P3P标题,我们设置CP值就可以了。

这篇文章提供了一些关于P3P的评论和一个简化的解决scheme,可以减lessIE7和IE8的问题。

我在这里没有提到的一个解决scheme是使用会话存储而不是cookie。 当然这可能不适合每个人的要求,但在某些情况下,这是一个简单的解决方法。

得到了类似的问题,也去调查今天上午如何生成P3P政策,这里是我的职位如何生成自己的政策和在网站上使用:) http://everydayopenslikeaflower.blogspot.com/2009/08/如何对创build-P3P政策和-implement.html

我已经实施了一个完整的P3P政策,但不希望再次为我正在开发的一个新项目经历麻烦。 我发现这个链接对于这个问题的一个简单的解决scheme很有用,只需要指定一个“CAO PSA OUR”最小的紧凑的P3P策略:

http://blog.sweetxml.org/2007/10/minimal-p3p-compact-policy-suggestion.html

文章引用了一个(现在断开的)链接到一个微软的kb文章。 该政策为我做了诡计!

我正在通过Azure访问控制服务调查这个loginclosures问题,无法连接任何东西的头部和尾部。

然后,偶然发现这个posthttps://blogs.msdn.microsoft.com/ieinternals/2011/03/10/beware-cookie-sharing-in-cross-zone-scenarios/

简而言之,IE浏览器不会跨区域共享cookie(例如Internet与受信任的站点)。

所以,如果你的iframe目标和html页面在不同的区域的P3P不会帮助任何东西。

您也可以像这样组合p3p.xml和policy.xml文件:

/home/ubuntu/sites/shared/w3c/p3p.xml

 <META xmlns="http://www.w3.org/2002/01/P3Pv1"> <POLICY-REFERENCES> <POLICY-REF about="#policy1"> <INCLUDE>/</INCLUDE> <COOKIE-INCLUDE/> </POLICY-REF> </POLICY-REFERENCES> <POLICIES> <POLICY discuri="" name="policy1"> <ENTITY> <DATA-GROUP> <DATA ref="#business.name"></DATA> <DATA ref="#business.contact-info.online.email"></DATA> </DATA-GROUP> </ENTITY> <ACCESS> <nonident/> </ACCESS> <!-- if the site has a dispute resolution procedure that it follows, a DISPUTES-GROUP should be included here --> <STATEMENT> <PURPOSE> <current/> <admin/> <develop/> </PURPOSE> <RECIPIENT> <ours/> </RECIPIENT> <RETENTION> <indefinitely/> </RETENTION> <DATA-GROUP> <DATA ref="#dynamic.clickstream"/> <DATA ref="#dynamic.http"/> </DATA-GROUP> </STATEMENT> </POLICY> </POLICIES> </META> 

我发现添加头的最简单的方法是通过Apache进行代理,并使用mod_headers,如下所示:

 <VirtualHost *:80> ServerName mydomain.com DocumentRoot /home/ubuntu/sites/shared/w3c/ ProxyRequests off ProxyPass /w3c/ ! ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ProxyPreserveHost on Header add p3p 'P3P:policyref="/w3c/p3p.xml", CP="NID DSP ALL COR"' </VirtualHost> 

因此,我们将所有请求(除了那些到/w3c/p3p.xml)都委托给我们的应用服务器。

您可以使用W3Cvalidation器进行全部testing

如果您拥有需要embedded的域 ,那么在调用包含IFrame的页面之前,您可以redirect到该域,这将创buildcookie并重新导向,如下所述: http://www.mendoweb。是/博客/networking资源pipe理器,Safari浏览器第三方cookie的问题/

这将适用于Internet Explorer,但也适用于Safari(因为Safari也会阻止第三方Cookie)。

我知道在这个问题上投入我的时间已经有点晚,但是我失去了那么多的时间,也许这个答案会帮助别人。

我试图在我的网站上调用第三方cookie,当然,即使在安全级别较低的情况下,它也不能在Internet Explorer 10上运行…不要问我为什么。 在iframe中,我用ajax调用了一个read_cookie.php(echo $ _COOKIE)。

我不知道为什么我无法设定P3P政策来解决问题…

在我的search过程中,我看到了有关在JSON中使用Cookie的一些问题。 我什至不尝试,因为我认为,如果cookie不会通过一个iframe,它不会再通过一个数组通过…

猜猜看是什么吧! 所以,如果你json_encode你的cookie,然后解码你的ajax请求,你会得到它!

也许有一些我错过了,如果我做了,所有的道歉,但我从来没有见过这么愚蠢的东西。 阻止第三方cookie的安全,为什么不,但如果编码通过它? 现在安全在哪里?

我希望这个post能够帮助别人,如果我错过了一些东西,我很愚蠢,请教育我!

这终于为我工作(经过大量的ha and并使用IBM策略生成器生成一些策略)。 您可以在此下载策略生成器: http : //www.softpedia.com/get/Security/Security-Related/P3P-Policy-Editor.shtml

我无法再从IBM官方网站下载生成器。

我在我的Web-App的根文件夹中创build了这些文件

 /index.php /w3c/policy.html (Human readable format) /w3c/p3p.xml /w3c/policy.p3p 
  1. Index.php:只需发送一个额外的标题:
 header('P3P: policyref="/w3c/p3p.xml", CP="ALL DSP NID CURa ADMa DEVa HISa OTPa OUR NOR NAV DEM"'); 
  1. 内容p3p.xml
 <META> <POLICY-REFERENCES> <POLICY-REF about="/w3c/policy.p3p#App"> <INCLUDE>/</INCLUDE> <COOKIE-INCLUDE/> </POLICY-REF> </POLICY-REFERENCES> </META> 
  1. 我的policy.html文件的内容
 <html> <head> <STYLE type="text/css"> title { color: #3333FF} </STYLE> <title>Privacy Statement for YOUR COMPANY NAME</title> </head> <body> <h1 class="title">Privacy Policy</h1> <!-- "About Us" section of privacy policy --> <h2>About Us</h2> <p>This is a privacy policy for YOUR COMPANY NAME. Our homepage on the Web is located at <a href="YOURWEBSITE"> YOURWEBSITE</a>. The full text of our privacy policy is available on the Web at <a href="ABSOLUTE URL OF THIS FILE"> ABSOLUTE URL OF THIS FILE</a> This policy does not tell users where they can go to exercise their opt-in or opt-out options. <p>We invite you to contact us if you have questions about this policy. You may contact us by mail at the following address: <pre>FIRSTNAME LASTNAME YOUR ADDRESS HERE </pre> <p>You may contact us by e-mail at <a href="mailto:info@YOURMAIL.de"> info@YOURMAIL.eu</a>. You may call us at TELEPHONENUMBER. <!-- "Privacy Seals" section of privacy policy --> <h2>Dispute Resolution and Privacy Seals</h2> <p>We have the following privacy seals and/or dispute resolution mechanisms. If you think we have not followed our privacy policy in some way, they can help you resolve your concern. <ul> <li> <b>Dispute</b>: Contact us for further information </ul> <!-- "Additional information" section of privacy policy --> <h2>Additional Information</h2> <p> This policy is valid for 1 day from the time that it is loaded by a client. </p> <!-- "Data Collection" section of privacy policy --> <h2>Data Collection</h2> <p>P3P policies declare the data they collect in groups (also referred to as "statements"). This policy contains 1 data group. <hr width="50%" align="center"> <h3>Group "App control data"</h3> <p>We collect the following information: <ul> <li>HTTP cookies</li> </ul> <p>This data will be used for the following purposes:</p> <ul> <li>Completion and support of the current activity.</li> <li>Web site and system administration.</li> <li>Research and development.</li> <li>Historical preservation.</li> <li>Other purposes<p>Control Flow of the application</p></li> </ul> <p>This data will be used by ourselves and our agents. <p>The data in this group has been marked as non-identifiable. This means that there is no reasonable way for the site to identify the individual person this data was collected from. <p>The following explanation is provided for why this data is collected:</p> <blockquote>This cookie data is only used to control the application within an iframe (eg a Facebook App)</blockquote> <!-- "Use of Cookies" section of privacy policy --> <hr width="50%" align="center"> <h2>Cookies</h2> <p>Cookies are a technology which can be used to provide you with tailored information from a Web site. A cookie is an element of data that a Web site can send to your browser, which may then store it on your system. You can set your browser to notify you when you receive a cookie, giving you the chance to decide whether to accept it. <p>Our site makes use of cookies. Cookies are used for the following purposes: <ul> <li>Site administration <li>Completing the user's current activity <li>Research and development <li>Other (Control Flow of the application) </ul> <!-- "Compact Policy Explanation" section of privacy policy --> <hr width="50%" align="center"> <h2>Compact Policy Summary</h2> <p>The compact policy which corresponds to this policy is: <pre> CP="ALL DSP NID CURa ADMa DEVa HISa OTPa OUR NOR NAV" </pre> <p>The following table explains the meaning of each field in the compact policy. <center><table width="80%" border="1" cols="2"> <tr><td align="center" valign="top" width="20%"><b>Field</b></td><td align="center" valign="top" width="80%"><b>Meaning</b></td></tr> <tr><td align="left" valign="top" width="20%"><tt>CP=</tt></td> <td align="left" valign="top" width="80%">This is the compact policy header; it indicates that what follows is a P3P compact policy.</td></tr> <tr><td align="left" valign="top" width="20%"><tt>ALL</tt></td> <td align="left" valign="top" width="80%"> Access to all collected information is available. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>DSP</tt></td> <td align="left" valign="top" width="80%"> The policy contains at least one dispute-resolution mechanism. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>NID</tt></td> <td align="left" valign="top" width="80%"> The information collected is not personally identifiable. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>CURa</tt></td> <td align="left" valign="top" width="80%"> The data is used for completion of the current activity. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>ADMa</tt></td> <td align="left" valign="top" width="80%"> The data is used for site administration. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>DEVa</tt></td> <td align="left" valign="top" width="80%"> The data is used for research and development. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>HISa</tt></td> <td align="left" valign="top" width="80%"> The data is used for historical archival purposes. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>OTPa</tt></td> <td align="left" valign="top" width="80%"> The data is used for other purposes. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>OUR</tt></td> <td align="left" valign="top" width="80%"> The data is given to ourselves and our agents. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>NOR</tt></td> <td align="left" valign="top" width="80%"> The data is not kept beyond the current transaction. </td></tr> <tr><td align="left" valign="top" width="20%"><tt>NAV</tt></td> <td align="left" valign="top" width="80%"> Navigation and clickstream data is collected. </td></tr> </table></center> <p>The compact policy is sent by the Web server along with the cookies it describes. For more information, see the P3P deployment guide at <a href="http://www.w3.org/TR/p3pdeployment">http://www.w3.org/TR/p3pdeployment</a>. <!-- "Policy Evaluation" section of privacy policy --> <hr width="50%" align="center"> <h2>Policy Evaluation</h2> <p>Microsoft Internet Explorer 6 will evaluate this policy's compact policy whenever it is used with a cookie. The actions IE will take depend on what privacy level the user has selected in their browser (Low, Medium, Medium High, or High; the default is Medium. In addition, IE will examine whether the cookie's policy is considered satisfactory or unsatisfactory, whether the cookie is a session cookie or a persistent cookie, and whether the cookie is used in a first-party or third-party context. This section will attempt to evaluate this policy's compact policy against Microsoft's stated behavior for IE6. <p><b>Note:</b> this evaluation is currently experimental and should not be considered a substitute for testing with a real Web browser. <p><b>Satisfactory policy</b>: this compact policy is considered <em>satisfactory</em> according to the rules defined by Internet Explorer 6. IE6 will accept cookies accompanied by this policy under the High, Medium High, Medium, Low, and Accept All Cookies settings. </body></html> 

In Rails I am using this gem : https://github.com/merchii/rack-iframe Bawically it sets a set of abbreviations without a reference file: https://github.com/merchii/rack-iframe/blob/master/lib/rack/iframe.rb#L8

It is easy to install when you dont care at all about the meaning of the p3p stuff.

For anyone trying to get the P3P Compact Policy working with static content:

It is only possible if you are able to send custom server-side response headers with the static content.

For a more detailed explanation see my answer here: Set P3P code in HTML

In Rails 3.2 I am using:

 class ApplicationController < ActionController::Base before_filter :set_p3p private # for IE session cookies thru iframe def set_p3p headers['P3P'] = 'CP="ALL DSP COR CURa ADMa DEVa OUR IND COM NAV"' end end 

I got this from: http://dot-net-web-developer-bristol.blogspot.com/2012/04/setting-p3p-header-in-rails-session.html

A better solution would be to make an Ajax call inside the iframe to the page that would get/set cookies…