IE6中设置隐私级别的时候,默认为中。拒绝第三方cookie。这样的话,标准的iframe 中的cookie,就无法获取了。
另外采用图片标签潜入的源码,cookie也无法得到。
比如当前页面为java-er.com/a.html
3.php中的cookie也无法得到。IE会显示block掉这个域名。php-er.com 相对当前页面为第三方cookie
效果相同,也会被拒绝。
iframe就是大家经常遇到的问题了。
解决第三方cookie问题,使用p3p即可搞定。
在php 读写cookie的文件第一行写
header("P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
一切都搞定了。
使用firebug会看到头信息多了一行P3P
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection keep-alive
Content-Encoding gzip
Content-Type text/html; charset=utf-8
Date Thu, 06 Sep 2012 07:38:07 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
P3P CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR
Pragma no-cache
Server nginx/1.0.14
IE6中,自然也可以得到自己想要的cookie了。
header("P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR这句话的意义
Compact Policies
Compact policies are essentially summaries of P3P policies. They can be used by user agents to quickly get approximate information about P3P policies, therefore improving performance.
For an in-depth explanation of compact policies, we refer to the P3P1.0[4] specification. Here, we limit to stating the syntax:
compact-policy-field = `CP="` compact-policy `"`
compact-policy = compact-token *(" " compact-token)
compact-token = compact-access |
compact-disputes |
compact-remedies |
compact-non-identifiable |
compact-purpose |
compact-recipient |
compact-retention |
compact-categories |
compact-test compact-access = "NOI" | "ALL" | "CAO" | "IDC" | "OTI" | "NON"
compact-disputes = "DSP"
compact-remedies = "COR" | "MON" | "LAW"
compact-non-identifiable = "NID"
compact-purpose = "CUR" | "ADM" [creq] | "DEV" [creq] | "TAI" [creq] |
"PSA" [creq] | "PSD" [creq] | "IVA" [creq] | "IVD" [creq] |
"CON" [creq] | "HIS" [creq] | "TEL" [creq] | "OTP" [creq]
creq = "a" | "i" | "o"
compact-recipient = "OUR" | "DEL" [creq] | "SAM" [creq] | "UNR" [creq] |
"PUB" [creq] | "OTR" [creq]
compact-retention = "NOR" | "STP" | "LEG" | "BUS" | "IND"
compact-category = "PHY" | "ONL" | "UNI" | "PUR" | "FIN" | "COM" |
"NAV" | "INT" | "DEM" | "CNT" | "STA" | "POL" |
"HEA" | "PRE" | "LOC" | "GOV" | "OTC"
compact-test = "TST"
P3P验证工具 http://www.w3.org/P3P/validator.html
延伸阅读 http://www.sitepoint.com/p3p-cookies-ie6/
You must be logged in to post a comment.
楼主写的这篇文章太好了!真的学到好东西。