0

I'm trying to open new windows in the background in Google Chrome version 62.0.3202.94. I run the code by typing in Notepad and copy-pasting into F12 Developer Console.

This is the code I've tried so far, adapted from various Google search results:

var url = "https://stackoverflow.com/";

function test1(){
    var w = window.open(url);
    w.blur();
    window.focus();
}

function test2(){
    window.open(url);
    window.open().close();
}

function test3(){
    window.open(url, "s", "width= 640, height= 480, left=0, top=0, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no").blur();
    window.focus();
}

And I typed test1() and test2() and test3() and hit Enter without achieving what I desired: The new page just opens and acquires the focus.

Any chance I could do that?


Note the emphasis on browser and version.

iBug
  • 35,554
  • 7
  • 89
  • 134
  • Possible duplicate of [Making a window pop under in chrome](https://stackoverflow.com/questions/4261784/making-a-window-pop-under-in-chrome) – Kos Jan 20 '18 at 14:33
  • @Kos Those answers don't work on Chrome 62. – iBug Jan 20 '18 at 14:34

1 Answers1

0

This would only work for opening new windows in the background, not new tabs

window.open('http://google.com','','height=500,width=500');
window.open().close();

Don't use popunders for evil

aljgom
  • 7,879
  • 3
  • 33
  • 28