Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 549
Anton Sementsov Avatar asked Feb 28 '13 10:02

Anton Sementsov


People also ask

What does window open returns?

open() returns, the window always contains about:blank . The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.

How do I open the same page in a new window?

Hold Ctrl and left-click or middle-click the Reload button on the location/address bar to open the current page in a new tab.


1 Answers

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.

like image 94
Joseph Avatar answered Oct 16 '22 10:10

Joseph