Hariharan
Hariharan

Reputation: 143

Window.focus() not working in IE11

I have the below javascript code which opens a url in new tab if it is not already opened. But if it is already opened it just bring it to focus. This code is working fine in Chrome. But not in IE11. All the url are in intranet zone.

 var loadingTonl;
 $('#tonlsg').click(function(){
 var url="<Some url>";
 if(loadingTonl == undefined || loadingTonl.closed)
    loadingTonl = window.open(url,'tonlFrame');
 else
    loadingTonl.focus();
 })

Upvotes: 2

Views: 3698

Answers (1)

LearnerEarner
LearnerEarner

Reputation: 1020

window.open() in IE returns NULL if Protected Mode is Enabled

This option can be toggled by unchecking "Enable Protedcted Mode" in Tools -> Internet Options -> Security: "Security level for this zone".

You will not face this issue if the web page is accessed from a proper website(from Internet).

Upvotes: 1

Related Questions