I’ve been struggling with this issue. I wanted a reference to another window, so I was issuing a:
otherWinRef = window.open("","OtherWindow");
However when I issue this command, the browser will switch focus to the OtherWindow. I thought this could be addressed by doing this:
otherWinRef = window.open("","OtherWindow");
window.focus();
but the window.focus() has no effect. I tried:
otherWinRef = window.open("","OtherWindow");
setTimeout(window.focus,0);
But the window.focus() call still had no effect.
I resolve the issue by adding the following code to the OtherWindow’s source.
function Bounce(w) {
window.blur();
w.focus();
}
Then I changed the code in the main window to:
otherWinRef = window.open("","OtherWindow");
otherWinRef.Bounce(window);