window.focus ()
Here is some code:
function myFunction() {
var myWindow = window.open("", "", "width=500,height=200");
myWindow.document.write("this is a focus window");
myWindow.focus();
}
Here is an example of the demo in action: