在Internet Explorer*问iFrame中的域Cookie

时间:2023-01-10 15:51:44

My domain (let's call it www.example.com) creates a cookie. On another site (let's say, www.myspace.com), my domain is loaded within an iFrame.

我的域名(我们称之为www.example.com)创建了一个cookie。在另一个网站上(比方说,www.myspace.com),我的域名被加载到iFrame中。

On every browser (Firefox, Opera, Camino, Safari, etc...) except for Internet Explorer, I can access my own cookie. In IE, it doesn't give me access to the cookie from within the iFrame.

在除Internet Explorer之外的每个浏览器(Firefox,Opera,Camino,Safari等)上,我都可以访问自己的cookie。在IE中,它不允许我从iFrame中访问cookie。

Is there a way to get around this?

有办法解决这个问题吗?

Really, this makes no sense because the site trying to access the cookie is www.example.com and the cookie is owned by www.example.com. But for some reason, IE thinks the iFrame makes them unrelated.

实际上,这没有任何意义,因为尝试访问cookie的网站是www.example.com,而cookie由www.example.com拥有。但出于某种原因,IE认为iFrame使它们无关。

3 个解决方案

#1


35  

Internet Explorer's default privacy setting means that 3rd-party cookies (e.g. those in iframes) are treated differently to 1st party cookies. (by default, 3rd party cookies are silently rejected).

Internet Explorer的默认隐私设置意味着第三方Cookie(例如iframe中的Cookie)与第一方Cookie的处理方式不同。 (默认情况下,第三方cookie被默默拒绝)。

For IE6 to accept cookies in an iframe, you need to ensure your site is delivering a P3P compact header.

要使IE6接受iframe中的cookie,您需要确保您的站点提供P3P紧凑头。

See http://msdn.microsoft.com/en-us/library/ms537343.aspx for more.

有关更多信息,请参见http://msdn.microsoft.com/en-us/library/ms537343.aspx。

#2


6  

In PHP: header ( "p3p:CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");

在PHP中:标题(“p3p:CP = \”IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT \“”);

#3


-1  

That sounds like a privacy setting issue to me. Either increase your security settings in IE (which you won't be able to convince your users to do), or take another approach.

这听起来像是一个隐私设置问题。要么增加IE中的安全设置(您无法说服用户这样做),要么采取其他方法。

#1


35  

Internet Explorer's default privacy setting means that 3rd-party cookies (e.g. those in iframes) are treated differently to 1st party cookies. (by default, 3rd party cookies are silently rejected).

Internet Explorer的默认隐私设置意味着第三方Cookie(例如iframe中的Cookie)与第一方Cookie的处理方式不同。 (默认情况下,第三方cookie被默默拒绝)。

For IE6 to accept cookies in an iframe, you need to ensure your site is delivering a P3P compact header.

要使IE6接受iframe中的cookie,您需要确保您的站点提供P3P紧凑头。

See http://msdn.microsoft.com/en-us/library/ms537343.aspx for more.

有关更多信息,请参见http://msdn.microsoft.com/en-us/library/ms537343.aspx。

#2


6  

In PHP: header ( "p3p:CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");

在PHP中:标题(“p3p:CP = \”IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT \“”);

#3


-1  

That sounds like a privacy setting issue to me. Either increase your security settings in IE (which you won't be able to convince your users to do), or take another approach.

这听起来像是一个隐私设置问题。要么增加IE中的安全设置(您无法说服用户这样做),要么采取其他方法。