ie cookie 无效
背景:由于项目需求,需要把一个页面嵌入到另外的一个项目,以iframe的方式,但是需要登录认证信息,登录后,把session放到cookie里面,在ie时失效。谷歌和firefox为正常。
解决办法是在要嵌入的内容中(iframe指向的站点)输出P3P的主机头声明:
php:
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
asp.net:
HttpContext.Current.Response.AddHeader("p3p", "CP=\""IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""")
jsp:
response.setHeader("P3P","CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'")
ColdFusion:
<cfheader name="P3P" value="CP='IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'" />