To focus on a new window (but you don’t want this, and by default it will have focus):
var newWindow = window.open("http://www.google.ro", '_blank');
newWindow.focus();
I don’t think you can steal focus from new open tabs. I did not find an official statement about this, but all the articles that I found about this will talk about setting up the browser to open default tabs without focus.
The only "solution" I could come up with is this:
window.open("http://google.com", "_blank");
window.alert('Hello there! This is a message that annoys you, the user.');
Please note that when you open pop-ups, you can move the focus.
window.
: , 2 , , SO , , .