0

I am using window.open() to open a new window and when i use window.focus(), it gives error "Unable to get property focus of undefined or null reference", when using MS Edge

I checked this question and it fixed the issue for IE: IE11-facing issue while calling focus() on window object

But this issue is still occuring on MS Edge. So this should not be a duplicate.

I am able to open intranet sites without any error, but when i open any external site in the popup, it gives this popup.

I saw this link on msdn which states that the Enhanced protected mode runs all the time in MS Edge. Could this be a reason for the issue?

i have already dcisable the Protected mode and Enhanced protected mode in Internet Options.

Please suggest ??

Folowing is my javascript function:

function LaunchCenteredWindowWithBars(windowWidth, windowHeight, windowName, windowUri) {
    try {
        var centerWidth = (window.screen.width - windowWidth) / 2;
        var centerHeight = (window.screen.height - windowHeight) / 2;

        newWindow = window.open(windowUri, windowName, 'width=' + windowWidth +
                ',height=' + windowHeight +
                ',left=' + centerWidth +
                ',top=' + centerHeight +
                ',toolbar=1,location=1,menubar=1,scrollbars=yes,status=yes,resizable=yes');

        newWindow.focus();
    }
    catch (e) { alert(e.message); }
}
Community
  • 1
  • 1
Shikhar Arora
  • 886
  • 1
  • 9
  • 14

1 Answers1

0

The answer to your question may be in this other posting...

focus() is not working in edge browser

Pocketninja
  • 395
  • 1
  • 12