38

I have such situation. I try to open a window with window.open function new window was opened in a front of main window, how can i open it in background of main window, without focus on new. Is it possible to do such thing?

bcmcfc
  • 25,966
  • 29
  • 109
  • 181
Anton Sementsov
  • 1,196
  • 6
  • 18
  • 34

3 Answers3

26

What you seek is called a "pop-under" window

Example:

var handle = window.open('https://stackoverflow.com/');
handle.blur();
window.focus();

However, it's not a guarantee as user browser settings may override this behavior, especially pop-up blockers.

Avatar
  • 14,622
  • 9
  • 119
  • 198
Joseph
  • 117,725
  • 30
  • 181
  • 234
-4

No you cant open window behind the main window. if you are using window.open() then it will be top of the main window. that's how the pop up windows works.
alternatively you can do this

Window.open(); 
yourMainWindow.focus();
Ravi Gadag
  • 15,735
  • 5
  • 57
  • 83
-16

Try using the Following

window.open("http://localhost/123", '_blank');
gangakvp
  • 91
  • 3