4

I am using IE8 on Windows 7. Referred to several threads and understand that in IE8 when I am using window.open to popup a new window, the JavaScript window.open is returning null value.

If I run IE as administrator or disable the protected mode, I see the window.open returns the expected object.

I am looking out for a solution apart from the options mentioned above. For such a small feature (opening a popup) I cannot ask customer to run IE as administrator or disable the protected mode.

If there is any work around, please let me know. It will be a great help.

Primarily, I want to make sure that only one window is opened when user clicks multiple times on the link and give the focus to the window which is already open. To achieve this I need to get the object from window.open so that I can check if the window is already open and give the focus to the already opened window. Otherwise open a new window.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
user1501905
  • 41
  • 1
  • 1
  • 2

2 Answers2

6

For IE10, 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 yoursite.com opens someothersite.com in popup window i.e. Internet->Internet

-1

You can use window.showModalDialog as a alternative or replacement for window.open method.

It is more secure then window.open. It will not allow user clicking the Parent page.

Example Usage:

var myFeatures = "dialogWidth:1060px;dialogHeight:550px;resizable:yes";

window.showModalDialog(url,window,myFeatures);
       //Here window is an object, no need to assign or declare.

If you want more detail explanation see Here. //Fifth Question.

Jayamurugan
  • 1,757
  • 2
  • 14
  • 34
  • Thanks for the reply! I tried the option suggested by you. But here the problem is parent window is locked. That is a problem again. I should be able to open one and only one child window, but still the user should be able to access the parent window for his other work. And if by mistake user clicks on the same link again, give him to focus to the child window which was opened earlier. – user1501905 Jul 05 '12 at 09:17
  • And surprisingly its behaving very strange in my case by using showModelDialog. The url i have given for child window is google.com to test. once the child window is open, if i do a google search in child window its automatically opening two extra windows every time i click on google search. – user1501905 Jul 05 '12 at 09:28
  • 5
    Deprecated - not available currently in Chrome or Firefox https://developer.mozilla.org/en-US/docs/Web/API/Window/showModalDialog – johnnycardy Jul 28 '15 at 09:00