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?
Asked
Active
Viewed 5.9k times
34
bcmcfc
- 24,671
- 28
- 106
- 175
Anton Sementsov
- 1,156
- 6
- 18
- 33
3 Answers
26
What you seek is called a "pop-under" window
- Open a new window using
let handle = window.open() - Lose focus of the new window by using
handle.blur() - The return focus to your existing window using
window.focus()
However, it's not a guarantee as user browser settings may override this behavior, especially pop-up blockers.
-3
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,509
- 5
- 56
- 83
-
Ok, maybe there are some other ways to open new window in background, without `window.open()` function – Anton Sementsov Feb 28 '13 at 10:59
-
@AntonSementsov What are the other ways to do the same through js. – Sanjay Goswami Jan 15 '16 at 13:41