Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On IE9, Win 7 window.open() returns null instead of reference of the opened window

I am trying something like below,

var myWindow = null;
if(!myWindow || myWindow.closed)
{
    myWindow = window.open(url, windowId);
}
else 
{
    myWindow.focus();   
}

All browsers return the window ref for window.open(), but IE 9 returns NULL. Does anybody have more information on why null is returned or possibly a workaround solution for IE9?

like image 866
srayker Avatar asked Aug 10 '11 16:08

srayker


Video Answer


2 Answers

window.open returns a NULL reference object if Enable Protected Mode is checked under Internet Options->Security->Security Level for this zone and the ZONE is different i.e. in my case local file opening a popup from Intranet.

window.open returns a reference object even if Enable Protected Mode is checked when mysite.com opens someothersite.com in popup window i.e. Internet->Internet

like image 189
srayker Avatar answered Sep 21 '22 15:09

srayker


Out of curiosity, what's your windowId? Does it have a space in it?

Because, apparently IE9 will fail if there's a space in the window title.

like image 42
OverZealous Avatar answered Sep 17 '22 15:09

OverZealous