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();