Skip to content Skip to sidebar Skip to footer

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 brows

Solution 1:

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

Solution 2:

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.

Solution 3:

Actually in my case, I was getting window.open reference null if I'm opening localhost or intranet site URL. If my popup contains any internet site url then I'm getting window object in reference. I did following to resolve this:

  • Open IE > Tools > Internet Options
  • Go to Security Tab
  • Enable Protected Mode by clicking the checkbox
  • Restart IE

Now, it started giving me window object reference for popup window opened with Intranet Sites.

Also, it could be the URL problem where it is secure or added in trusted sites zone. If you can provide the URL it will help.

Hope this helps.

Solution 4:

We had this problem with our app. We are using external uploads using Dropbox and it was not working.

This is how we fixed it. Summarizing the different reads and solutions. Please let me know if any part is not correct or does not make sense.

Root Cause:

Starting from IE11, Windows has started assigning the security levels to the applications at the time of startup. Low-Security window and High-security window. Also starting IE11, when new popup opens, it is not a sub-window of the main browser window. Instead, it is a whole new IE11 instance with different security level assigned to it. Usually, the external upload mechanism works using the cross window messaging feature of JavaScript. If that does not work, external uploads do not work. As per windows security standards, a low-security window cannot send a message to the high-security window. Taking a step back and looking at our windows machine, they are shipped by our Internal team. By the default, all our domain web applications are added to trusted sites in our windows machines. But external upload links like Dropbox is not added to the trusted sites. So when you open Our App in IE11, windows automatically marks IE11 window as High-security window. Now, when you try to upload a design file through Dropbox because Dropbox is not trusted site, the new popup that gets created is a new IE11 instance with low-security level. Due to this, after the Dropbox window opened, it loses connection with the parent window that is Our App. This is causing the issue with External uploads

Fix:

  1. Either add both yoursite.com and dropbox.com to trusted sites in IE11 through Internet Options > Security > Trusted Sites or remove them both.

  2. Enable Protected Mode in IE11 by marking Enable Protected Mode in IE11 through Internet Options > Security > Enable Protected Mode and then restart the browser.

This means it is not a real issue for our Customers. If it's not working for them, it is either due to the reason, either of the sites is added to the trusted sites list but not both.

Post a Comment for "On Ie9, Win 7 Window.open() Returns Null Instead Of Reference Of The Opened Window"