0

From a web page, I need to open a new window, for example, in a new tab. The desired behavior is for Google Chrome to come to the foreground when opening the new tab. But it only works properly when before using other applications, the browser is minimized. If you use other applications without minimizing the browser, when you open the new tab, the Chrome icon "blinks" in orange, but it does not come to the fore. Is there any solution? I have thought about programmatically minimizing the browser, but I have also seen that it is not possible.

I have seen similar problems (Javascript Bring window to front if already open in window.open? or How do I bring an already existing open window to the front on top of other windows from another windows code?), but they are not the same, and I have tried many of the things discussed in them, without success.

The code is simple:

var a = window.open("http://www.google.com");
a.focus();
gabi13
  • 101
  • 8
  • That code opens a new tab for me. – D. Pardal May 04 '20 at 16:12
  • In fact, Chrome will make sure that the pop-up window is on top of the regular browser window, in order to avoid pop-unders. – D. Pardal May 04 '20 at 16:14
  • 1
    *"The desired behavior is for Google Chrome to come to the foreground when opening the new tab."* If that's what you mean in terms of this question being different, you can't make that happen, nor should you be able to. The user, not your page, is in control of what window is foremost on their desktop. Moreover, if the browser is in the background, the user won't have just interacted with it, and you won't be able to open a new tab at all unless they've disabled the built-in popup blocking, since with the default settings, you can only open a new window/tab in response to a user action. – T.J. Crowder May 04 '20 at 16:18

0 Answers0