398

我有两个网站,假设它们是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 中不会出现此问题。

出于测试目的,我在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+服务器端脚本显然能够回避这个问题,但这看起来很像一个错误,而且它打开了一组全新的安全漏洞。我不希望我的应用程序使用错误+安全漏洞的组合只是因为它很容易。

编辑:P3P 政策是根本原因,下面是完整的解释。

4

22 回答 22

432

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

发生了什么

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

邪恶的眼睛
(来源:piskvor.org

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

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

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

如何解决

创建 p3p 策略

W3C 教程是一个很好的起点。我浏览了它,下载了IBM 隐私政策编辑器,在那里我创建了隐私政策的表示,并给它一个名称以供参考(这里是policy1)。

注意:此时,您实际上需要确定您的网站是否有隐私政策,如果没有,请创建它 - 它是否收集用户数据,什么样的数据,它用它做什么,谁可以访问它,等等。你需要找到这些信息并考虑一下。只是将几个标签贴在一起不会削减它。此步骤不能仅在软件中完成,并且可能具有高度政治性(例如,“我们应该出售我们的点击统计数据吗?”)。

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

(使用此工具进行编辑时,可以查看策略中的错误/遗漏。“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(在我的例子中是整个站点)。我从编辑器导出的策略文件已上传到http://example.com/w3c/example-com.p3p

发送带有响应的紧凑标头

我在 example.com 上设置了网络服务器以发送带有响应的紧凑标头,如下所示:

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 标题中添加一些标签,直到 Evil Eye 放弃”。

标签不仅是一堆比特,它们还具有现实世界的意义,它们的使用赋予了你现实世界的责任

例如,假装你从不收集用户数据可能会让浏览器高兴,但如果你真的收集用户数据,那么 P3P 与现实相冲突。简单明了,您是故意对用户撒谎,这在某些国家可能是犯罪行为。如,“去监狱,不要收 200 美元”。

一些示例(请参阅 p3pwriter 了解完整的标签集):

  • NOI:“网站不收集已识别的数据。” (一旦有任何自定义、登录或任何数据收集(***** 分析,有人吗?),您必须在 P3P 中确认)
  • STP:保留信息以满足所述目的。这要求尽可能早地丢弃信息。站点必须具有建立销毁时间表的保留策略。保留政策必须包含在网站的可读隐私政策中或与之链接。”(因此,如果您发送STP但没有保留政策,您可能会进行欺诈。这有多酷?一点也不。)

我不是律师,但我不愿意去法庭看看 P3P 标头是否真的具有法律约束力,或者您是否可以向您的用户承诺任何事情而实际上并不愿意兑现您的承诺。

于 2008-12-23T17:08:34.783 回答
170

我一天中的大部分时间都在研究这个 P3P 事物,我觉得有必要分享我的发现。

我注意到 P3P 概念非常过时,似乎只有 Internet Explorer (IE) 真正使用/强制执行。

最简单的解释是:如果您使用 cookie,IE 希望您定义一个 P3P 标头。

这是一个好主意,幸运的是,大多数时候不提供此标头不会导致任何问题(阅读浏览器警告)。除非您的网站/Web 应用程序使用 (i)Frame 加载到其他网站。这就是IE在***中成为巨大痛苦的地方。除非设置了 P3P 标头,否则它将不允许您设置 cookie。

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

  1. 谁在乎?换句话说,如果我在标题中输入“Potato”一词,我会被起诉吗?
  2. 其他公司是做什么的?

我的发现是:

  1. 没人在乎。我找不到表明该技术具有任何法律效力的单一文件。在我的研究中,我没有发现世界上任何一个国家都通过了一项法律,禁止你在 P3P 标题中添加“Potato”这个词
  2. Google 和 Facebook 都在其 P3P 标头字段中放置了一个链接,该链接指的是描述他们为什么没有 P3P 标头的页面。

这个概念诞生于 2002 年,令我感到困惑的是,这个过时且在法律上未实现的概念仍然强加给 IE 内的开发人员。如果此标头没有任何法律后果,则应忽略此标头(或者,在控制台中生成警告或通知)。不强制!我现在被迫在我的代码中添加一行(并向客户端发送一个标头),这完全没有任何作用。

简而言之 - 为了让 IE 满意 - 将以下行添加到您的 PHP 代码中(其他语言应该看起来相似)

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

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

于 2013-05-10T04:16:00.193 回答
57

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

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

请记住按 ctrl+F5重新加载您的站点,否则 Explorer 可能仍会显示邪恶的眼睛,尽管它工作正常。这可能是我在让它工作时遇到这么多问题的主要原因。

根本不需要任何策略文件。

编辑:我发现了一个很好的博客条目,它解释了 IFrame 中的 cookie 问题。它在 C# 代码中也有一个快速修复: Frames, ASPX Pages and Rejected Cookies

于 2010-02-19T15:24:43.240 回答
21

这隐藏在其他答案的评论中,但我几乎错过了它,所以它似乎应该得到自己的答案。

回顾:为了让 IE 接受 3rd 方 cookie,您需要使用名为 p3p 的 http 标头以以下格式提供文件:

CP="my compact p3p policy"

但是,在这一点上,p3p 作为标准几乎已经死了,您可以轻松地让 IE 工作,而无需投入时间和法律资源来创建真正的 p3p 策略。这是因为如果您的紧凑 p3p 策略标头无效,IE 实际上会将其视为良好策略并接受 3rd 方 cookie。所以你可以使用这样的 p3p 标头

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

您可以选择包含指向页面的链接,该链接解释您为什么没有 p3p 政策,就像 Google 和 Facebook 所做的那样(他们指向此处: https: //support.google.com/accounts/answer/151657和此处:https ://www.facebook.com/help/327993273962160/)。

最后,重要的是要注意,从第 3 方站点提供的所有文件都需要具有 p3p 标头,而不仅仅是设置 cookie 的文件,因此您可能无法仅在 PHP、asp.net 等中执行此操作代码。您最好设置在 Web 服务器级别(即在 IIS 或 Apache 中)。

于 2013-05-24T14:16:26.077 回答
20

我也遇到了这个问题,以为我会发布我在 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();
    }
}
于 2011-10-27T19:21:55.980 回答
14

这是关于这个问题的一个很好的话题,但是我发现没有在这里或其他任何地方发布的一个重要细节(至少在我的情况下是必不可少的)(如果我错过了,我很抱歉)是 P3P 线路必须是传入从第 3 方服务器发送的每个文件的标头,即使是未设置或使用 cookie 的文件,例如 Javascript 文件或图像。否则 cookie 将被阻止。我在这里的帖子中有更多关于此的信息:http: //posheika.net/ ?p=110

于 2010-08-23T22:44:45.910 回答
5

在 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

于 2013-04-17T07:06:34.300 回答
5

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

标头设置 P3P "CP=\"感谢 IE8\""

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

于 2014-01-07T22:06:01.007 回答
4

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

于 2009-04-17T10:10:20.277 回答
3

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

于 2011-04-05T13:02:35.883 回答
3

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

于 2012-06-13T12:00:40.663 回答
3

我正在调查有关通过 Azure 访问控制服务注销的问题,但无法连接任何东西的头部和尾部。

然后,偶然发现了这篇文章https://blogs.msdn.microsoft.com/ieinternals/2011/03/10/beware-cookie-sharing-in-cross-zone-scenarios/

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

因此,如果您的 IFrame 目标和 html 页面位于不同区域的 P3P 将无济于事。

于 2016-04-06T14:23:18.017 回答
2

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

于 2009-08-21T15:39:51.587 回答
2

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

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

该文章引用了 Microsoft 知识库文章的(现已损坏)链接。政策对我有用!

于 2011-09-13T14:47:09.543 回答
1

您还可以像这样组合 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 之外的所有请求代理到我们的应用程序服务器。

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

于 2012-11-09T15:46:56.617 回答
1

我知道将我的贡献放在这个主题上有点晚了,但是我浪费了很多时间,也许这个答案会对某人有所帮助。

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

而且我不知道为什么我无法设置 P3P 策略来解决问题......

在我的搜索过程中,我看到了一些关于让 JSON 中的 cookie 工作的东西。我什至没有尝试,因为我认为如果 cookie 不会通过 iframe,它就不会再通过数组...

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

也许我错过了什么,如果我错过了,我很抱歉,但我从未见过如此愚蠢的事情。为安全起见阻止第三方 cookie,为什么不,但如果编码则让它通过?现在安全在哪里?

我希望这篇文章能再次对某人有所帮助,如果我错过了什么并且我很愚蠢,请教育我!

于 2012-12-12T18:37:56.060 回答
1

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

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

于 2014-08-27T15:18:04.077 回答
1

这终于对我有用(经过很多麻烦并使用 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
  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 (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>

  1. 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>
于 2015-02-26T18:38:40.043 回答
0

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

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

于 2014-04-15T23:20:11.707 回答
0

对于任何试图让 P3P 紧凑策略处理静态内容的人:

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

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

于 2015-06-13T01:34:51.480 回答
0

在 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

于 2015-06-18T20:27:11.540 回答
-1

更好的解决方案是在 iframe 内对将获取/设置 cookie 的页面进行 Ajax 调用...

于 2009-01-07T16:06:59.037 回答