您的位置:首页 > 其它

sarafi浏览器iframe跨域cookie无效的处理方案(笨方法,看官莫笑)

2016-01-15 17:50 260 查看
<script>
$(function(){
url = 'oauth_authorize_api';
loaded = false;
iframe = '<iframe id="login" width="100%" height="500" src="' + url + '"></iframe>';
$(".test").click(function(){
if(loaded) return false;
if(!/chrome\/\d+/.test(navigator.userAgent.toLowerCase()) && /safari\/\d+/.test(navigator.userAgent.toLowerCase())) {
myWindow = window.open(url,"myWindow",'width=1,height=1');
setTimeout(function(){
myWindow.close();
$("#iframe").append(iframe);
},1000);
} else {
$("#iframe").append(iframe);
}
loaded = true;
});
})
</script>
<a class="test" href="#">登录</a>

<div id="iframe"></div>


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: