Open new window without focus on it [duplicate]

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?


Solution 1:

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.