我有两个网站,比如说example.com和anotherexample.net。 在anotherexample.net/page.html上,我有一个IFRAME SRC=“http://example.com/someform.asp”。IFRAME显示一个表单供用户填写并提交到http://example.com/process.asp。当我在它自己的浏览器窗口中打开表单(“someform.asp”)时,一切正常。 然而,当我在ie6或ie7中加载someform.asp作为IFRAME时,example.com的cookie没有保存。在Firefox中,这个问题不会出现。

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

example.com使用基于cookie的会话(对此我无能为力),因此如果没有cookie, process.asp将无法执行。我如何迫使IE保存这些cookie ?

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

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

编辑:P3P政策是根本原因,详细解释如下。


我让它工作了,但解决方案有点复杂,所以请耐心等待。

发生了什么

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

(来源:piskvor.org)

在这种情况下,当cookie被阻塞时,会话标识符不会发送,目标脚本抛出'session not found'错误。

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

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

如何解决

创建p3p策略

W3C教程是一个很好的起点。我已经浏览了它,下载了IBM隐私策略编辑器,并在那里创建了隐私策略的表示,并为它指定了一个名称以供引用(这里是policy1)。

注意:在这一点上,你实际上需要找出你的网站是否有隐私政策,如果没有,就创建它——它是否收集用户数据,什么样的数据,它用它做什么,谁可以访问它,等等。你需要找到这些信息并思考。仅仅把几个标签拼凑在一起是不够的。这一步不能纯粹在软件中完成,而且可能是高度政治化的(例如。“我们是否应该出售我们的点击统计数据?”)。

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

(使用此工具编辑时,可以查看策略中的错误/遗漏。同样非常有用的标签是“HTML策略”:在底部,它有一个“策略评估”-一个快速检查策略是否会被IE的默认设置阻止)

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

链接到策略

然后需要一个政策参考文件(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(在我的示例中是整个站点)。我从Editor导出的策略文件上传到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头必须如实代表您自己的隐私政策!

利润!

在此配置中,Evil Eye不会出现,cookie甚至保存在IFRAME中,应用程序可以正常工作。

编辑:不要做什么,除非你喜欢从诉讼中辩护

一些人建议“在你的P3P头中加入一些标签,直到邪恶之眼放弃”。

标签不仅仅是一堆比特,它们具有现实世界的含义,它们的使用赋予您现实世界的责任!

例如,假装您从未收集用户数据可能会让浏览器高兴,但如果您实际收集用户数据,P3P就与现实相冲突。简单地说,你是在故意欺骗你的用户,这在某些国家可能是犯罪行为。就像"进监狱,拿不到200美元"

以下是一些示例(完整的标签集请参阅p3pwriter):

NOI : "Web Site does not collected identified data." (as soon as there's any customization, a login, or any data collection (***** Analytics, anyone?), you must acknowledge it in your P3P) STP: Information is retained to meet the stated purpose. This requires information to be discarded at the earliest time possible. Sites MUST have a retention policy that establishes a destruction time table. The retention policy MUST be included in or linked from the site's human-readable privacy policy." (so if you send STP but don't have a retention policy, you may be committing fraud. How cool is that? Not at all.)

我不是律师,但我不愿意去法庭上看看P3P头是否真的具有法律约束力,或者你是否可以在不愿意履行承诺的情况下向用户承诺任何东西。

更好的解决方案是在iframe中对页面进行Ajax调用,以获取/设置cookie…

一种可能的做法是将域添加到工具-> internet选项-> privacy -> sites: somedomain.com -> allow -> OK。

遇到类似的问题,今天早上也去调查了如何生成P3P策略,这是我关于如何生成你自己的策略并在网站上使用的帖子:) http://everydayopenslikeaflower.blogspot.com/2009/08/how-to-create-p3p-policy-and-implement.html

我可以通过简单地在IFrame (PHP解决方案)中添加这个小标题来消除邪恶的眼睛:

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

记住按ctrl+F5重新加载你的网站,否则资源管理器可能仍然会显示邪恶之眼,尽管它工作正常。这可能是为什么我有这么多问题让它工作的主要原因。

根本不需要策略文件。

编辑: 我发现了一篇很好的博客文章,解释了IFrames中cookie的问题。它在c#代码中也有一个快速修复: 框架,ASPX页面和拒绝的cookie

这是一个很好的话题,但我发现一个重要的细节(这是必不可少的,至少在我的情况下),没有张贴在这里或其他任何地方(我道歉,如果我刚刚错过了它)是P3P行必须在每个文件的头从第三方服务器发送,甚至文件没有设置或使用cookie,如Javascript文件或图像。否则cookie将被阻止。我有更多关于这个的帖子在这里:http://posheika.net/?p=110

这篇文章提供了一些关于P3P的评论,以及一个减少IE7和IE8问题的捷径解决方案。

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

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

这篇文章引用了一个指向Microsoft kb文章的链接(现在已失效)。政策对我起作用了!

我也有这个问题,我想我会张贴我在我的MVC2项目中使用的代码。当你在页面生命周期中添加头时要小心,否则你会得到一个HttpException“服务器不能在HTTP头发送后追加头”。我在onactionexecution方法上使用了自定义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();
    }
}

这里没有提到的一种解决方案是使用会话存储而不是cookie。 当然,这可能不适合每个人的要求,但在某些情况下,这是一个很容易解决的问题。

你也可以将p3p.xml和policy.xml文件结合起来:

单击/ home / ubuntu sites -分享- w3c xml p3p。

<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的请求外,我们将所有请求都代理到我们的应用服务器。

您可以使用W3C验证器进行测试

我知道现在在这个问题上发表我的观点有点晚了,但我浪费了这么多时间,也许这个答案会帮助到别人。

我试图在我的网站上调用第三方cookie,当然它不能在ie10上工作,即使是在低安全级别…别问我为什么。在iframe中,我用ajax调用read_cookie.php (echo $_COOKIE)。

我不知道为什么我不能设置P3P策略来解决这个问题……

在我的搜索过程中,我看到了一些关于在JSON中获得cookie的工作。我甚至没有尝试,因为我认为如果cookie不会通过iframe,它将不会再通过数组…

你猜怎么着,确实如此!所以如果你json_encode你的cookie,然后解码后你的ajax请求,你会得到它!

也许我错过了什么,如果我错过了,我很抱歉,但我从没见过这么蠢的东西。阻止第三方cookie的安全性,为什么不,但让它通过编码?保安现在在哪里?

我希望这篇文章能帮助别人,如果我错过了什么,我很笨,请教育我!

任何人在node.js中遇到这个问题。

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

npm install p3p

我正在使用express,所以我在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

我花了一天的大部分时间研究P3P的事情,我觉得有必要分享我的发现。

我注意到P3P概念已经非常过时了,似乎只有IE (Internet Explorer)才真正使用/实施。

最简单的解释是:IE希望您在使用cookie时定义P3P报头。

这是一个很好的想法,幸运的是,大多数时候不提供这个报头不会引起任何问题(请阅读浏览器警告)。除非您的网站/web应用程序是使用(i)框架加载到其他网站。这就是IE成为***的巨大痛苦之处。除非设置了P3P报头,否则它将不允许您设置cookie。

了解到这一点,我想找到以下两个问题的答案:

谁在乎呢?换句话说,如果我把“土豆”这个词放在标题中,我会被起诉吗? 其他公司怎么做?

我的发现是:

没人在乎。我找不到任何一份文件表明这项技术有任何法律效力。在我的研究中,我没有发现世界上任何一个国家通过法律禁止在P3P标题中使用“Potato”这个词 谷歌和Facebook都在他们的P3P报头字段中放了一个链接,指向一个页面,描述为什么他们没有P3P报头。

这个概念诞生于2002年,让我困惑的是,这个过时的、法律上未实现的概念仍然被强加在IE的开发人员身上。 如果此报头没有任何法律后果,则应忽略此报头(或者在控制台中生成警告或通知)。不执行!我现在被迫在我的代码中放入一行(并向客户端发送一个报头),它完全不做任何事情。

简而言之,为了让IE满意,在PHP代码中添加以下代码行(其他语言应该看起来类似)

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

问题解决了,IE对这个土豆很满意。

这个问题被埋在其他答案的评论中,但我几乎没有注意到,所以它似乎应该有自己的答案。

回顾一下:为了让IE接受第三方cookie,你需要为你的文件提供一个名为p3p的http头文件,格式如下:

CP="my compact p3p policy"

但是,在这一点上,p3p作为一个标准几乎已经死了,你可以很容易地让IE工作,而不需要投入时间和法律资源来创建一个真正的p3p策略。这是因为如果你的p3p策略头是无效的,IE实际上会把它当作一个好策略,并接受第三方cookie。你可以使用这样的p3p头文件

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

您可以选择包含一个页面链接,以解释为什么您没有p3p策略,就像谷歌和Facebook所做的那样(它们指向这里:https://support.google.com/accounts/answer/151657和这里:https://www.facebook.com/help/327993273962160/)。

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

如果有人在寻找阿帕奇线;我们用了这个。

头集P3P "CP=\"谢谢IE8\""

只要有P3P报头,我们将CP值设置为什么并不重要。

在Rails中,我使用这个宝石:https://github.com/merchii/rack-iframe Bawically它设置了一组没有引用文件的缩写:https://github.com/merchii/rack-iframe/blob/master/lib/rack/iframe.rb#L8

当您完全不关心p3p内容的含义时,它很容易安装。

如果你拥有需要嵌入的域,那么你可以,在调用包含IFrame的页面之前,重定向到那个域,它将创建cookie并重定向回来, 如下所述:http://www.mendoweb.be/blog/internet-explorer-safari-third-party-cookie-problem/

这不仅适用于ie浏览器,也适用于Safari浏览器(因为Safari浏览器也会屏蔽第三方cookie)。

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

我再也不能从IBM官方网站下载生成器了。

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

/index.php
/w3c/policy.html (Human readable format)
/w3c/p3p.xml
/w3c/policy.p3p

Index.php:只发送一个额外的头文件:

header('P3P: policyref="/w3c/p3p.xml", CP="ALL DSP NID CURa ADMa DEVa HISa OTPa OUR NOR NAV DEM"');

p3p.xml的内容

<META>
    <POLICY-REFERENCES>
        <POLICY-REF about="/w3c/policy.p3p#App">
            <INCLUDE>/</INCLUDE>
            <COOKIE-INCLUDE/>
        </POLICY-REF>
    </POLICY-REFERENCES>
</META>

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 (e.g. 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>

policy.p3p的内容

<?xml version="1.0"?>
<POLICIES xmlns="http://www.w3.org/2002/01/P3Pv1">
    <!-- Generated by IBM P3P Policy Editor version Beta 1.12 built 2/27/04 1:19 PM -->

    <!-- Expiry information for this policy -->
    <EXPIRY max-age="86400"/>

<POLICY
    name="App"
    discuri="ABSOLUTE URL TO policy.html"
    xml:lang="de">
    <!-- Description of the entity making this policy statement. -->
    <ENTITY>
    <DATA-GROUP>
<DATA ref="#business.name">COMPANY NAME</DATA>
<DATA ref="#business.contact-info.online.email">info@YOURMAIL.eu</DATA>
<DATA ref="#business.contact-info.online.uri">YOURWEBSITE</DATA>
<DATA ref="#business.contact-info.telecom.telephone.number">YOURPHONENUMBER</DATA>
<DATA ref="#business.contact-info.postal.organization">FIRSTNAME LASTNAME</DATA>
<DATA ref="#business.contact-info.postal.street">STREET</DATA>
<DATA ref="#business.contact-info.postal.city">CITY</DATA>
<DATA ref="#business.contact-info.postal.stateprov">STAGE</DATA>
<DATA ref="#business.contact-info.postal.postalcode">POSTALCODE</DATA>
<DATA ref="#business.contact-info.postal.country">Germany</DATA>
    </DATA-GROUP>
    </ENTITY>

    <!-- Disclosure -->
    <ACCESS><all/></ACCESS>


    <!-- Disputes -->
    <DISPUTES-GROUP>
        <DISPUTES resolution-type="service" service="YOURWEBSITE CONTACT FORM" short-description="Dispute">
            <LONG-DESCRIPTION>Contact us for further information</LONG-DESCRIPTION>
    <!-- No remedies specified -->
        </DISPUTES>
    </DISPUTES-GROUP>

    <!-- Statement for group "App control data" -->
    <STATEMENT>
        <EXTENSION optional="yes">
            <GROUP-INFO xmlns="http://www.software.ibm.com/P3P/editor/extension-1.0.html" name="App control data"/>
        </EXTENSION>

    <!-- Consequence -->
    <CONSEQUENCE>
This cookie data is only used to control the application within an iframe (e.g. a Facebook App)</CONSEQUENCE>

    <!-- Data in this statement is marked as being non-identifiable -->
    <NON-IDENTIFIABLE/>

    <!-- Use (purpose) -->
    <PURPOSE><admin/><current/><develop/><historical/><other-purpose>Control Flow of the application</other-purpose></PURPOSE>

    <!-- Recipients -->
    <RECIPIENT><ours/></RECIPIENT>

    <!-- Retention -->
    <RETENTION><no-retention/></RETENTION>

    <!-- Base dataschema elements. -->
    <DATA-GROUP>
    <DATA ref="#dynamic.cookies"><CATEGORIES><navigation/></CATEGORIES></DATA>
    </DATA-GROUP>
</STATEMENT>

<!-- End of policy -->
</POLICY>
</POLICIES>

对于任何试图让P3P契约策略与静态内容一起工作的人:

只有当您能够发送带有静态内容的自定义服务器端响应标头时才有可能。

有关更详细的解释,请参阅我的回答:在HTML中设置P3P代码

在Rails 3.2中,我使用:

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  

我从http://dot-net-web-developer-bristol.blogspot.com/2012/04/setting-p3p-header-in-rails-session.html得到了这个

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

然后,无意中看到了这个帖子https://blogs.msdn.microsoft.com/ieinternals/2011/03/10/beware-cookie-sharing-in-cross-zone-scenarios/

简而言之,IE不会跨区域共享cookie。互联网vs.可信站点)。

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