iframe Safari中的跨网域Cookie [英] Cross-domain cookies in iframe Safari

查看:1111
本文介绍了iframe Safari中的跨网域Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在在iframe(从其他网域加载网站)中设置Cookie时遇到问题。

在我的网站X.COM上,我加载< iframe src =' Y.COM'>



Y.COM尝试设置Cookie,但Safari会阻止他们,因为此网站以前未访问过。所以加载Y.COM失败,因为它不能工作没有cookie。有没有办法解决这个问题?



我不能修改任何数据在Y.COM。



P.S.S。此外,我们可以修改Safari的设置 - 接受cookie=总是,但它不是一个解决方案 - 似乎是不可能领导每个用户做..

解决方案

我试验了一个类似的问题。网络父页面在jquery fancybox i-frame跨域中打开我的子网站。没有问题,所有与Explorer,Chrome,Firefox,Opera,甚至与Mac上的Safari(5.8.1)。但是对于iPhone,iPad和迷你iPad,i-frame中的会话丢失了。



这意味着每次点击i-frame



我们以非常简单的方式解决问题:

当父网站开始时,它直接调用子站点中的页面(不在i帧中)。在这个页面中,我只是设置一个会话变量,我重定向到父网站。现在,当子网站在iframe中打开时,会话将保留。


I have a problem with setting cookies in an iframe (which loads a site from another domain).
On my site X.COM I load <iframe src='Y.COM'>

Y.COM tries to set cookies, but Safari blocks they, as this site was not visited before. So loading Y.COM fails because it can't work without cookies. Is there a way to solve this issue?

P.S. I cann't modify any data at Y.COM.

P.S.S. Also we can modify Safari's settings - "Accept cookies" = "Always", but it is not a solution for me - it seems to be impossible to lead every user to do it..

解决方案

I experimented a similar problem. A web "parent" page open my "child" website in a jquery fancybox i-frame cross-domain. Not problem at all with Explorer, Chrome, Firefox, Opera and even with Safari (5.8.1) on MAC. But with iPhone, iPad and mini iPad, the session in the i-frame is lost.

That's mean that at every click on an element in the i-frame (web site is in aspx) a new session started.

We solve the problem in a very simple way:

when the parent website start, it call a page in the child site directly (not in an i-frame). In this page I just set a session variable and I redirect to the parent website. Now when the child website is open in an iframe, the session is kept.

这篇关于iframe Safari中的跨网域Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆