【发布时间】:2013-07-31 17:10:57
【问题描述】:
window.open() 在 IE9 上总是返回以 true 关闭的端口。这是我在 Facebook 上的 oAuth 代码:
$(window).ready(function(){
$("#linkFacebook").click(LoginFb);
});
var winInter;
var win;
function LoginFb(){
var linkFB = '@Url.Action("LogOn", "Facebookk")';
win = window.open(linkFB, 'FB', 'toolbar=0,scrollbars=1,status=1,menubar=1,location=0,resizable=1,width=560,height=500');
winInter = setInterval(checkWindow, 1000);
}
function checkWindow()
{
try {
if (win.closed)
{
clearTimeout(winInter);
window.location.href = "@Url.Action("Index", "User")";
}
}
catch (e)
{ }
}
我在 msdn 上发现了这个错误: http://support.microsoft.com/kb/241109 ,但周围的工作不起作用。因为 window.opener.childOpen 总是返回 null。
我也试试下面的代码:
var WindowRef = null;
function openWindow(url, name, props) {
if(WindowRef == null){
WindowRef = window.open(url, name, props)
}
else{
WindowRef.document.location = url
}
if (!WindowRef.opener) {
WindowRef.opener = self;
}
WindowRef.focus();
return WindowRef;
}
我在这里找到:window.open() returns undefined or null on 2nd call
编辑:http://www.myspace.com 在 IE 上工作。我不明白他们是怎么做到的。
【问题讨论】:
-
请用四个空格缩进格式化代码。
-
什么是
linkFB?是同一个域还是不同域? -
LinkFB 是 URL。 oAuth URL。
标签: javascript facebook internet-explorer oauth