window.open() returns always the porpertie closed in true, on IE9. This is my code to oAuth on Facebook:
$(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)
{ }
}
I found this bug on msdn: http://support.microsoft.com/kb/241109 , but the work arround does not work. Because window.opener.childOpen always returns me null.
I also try the following code:
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;
}
which I find here: window.open() returns undefined or null on 2nd call
EDIT: on http://www.myspace.com works on IE. I do't understand how they do it.