jQuery 打开新窗口而不关注它

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15133605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 14:26:24  来源:igfitidea点击:

Open new window without focus on it

javascriptjqueryhtmldom

提问by Anton Sementsov

I have such situation. I try to open a window with window.openfunction 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?

我有这样的情况。我尝试打开一个具有window.open功能的窗口,新窗口在主窗口的前面打开,如何在主窗口的背景中打开它,而不关注新窗口。有可能做这样的事情吗?

采纳答案by Joseph

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

您所寻找的称为“弹出式”窗口

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

但是,这不能保证,因为用户浏览器设置可能会覆盖此行为,尤其是弹出窗口阻止程序。

回答by Ravi Gadag

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()那么它将位于主窗口的顶部。这就是弹出窗口的工作原理。
或者你可以这样做

Window.open(); 
yourMainWindow.focus();

回答by gangakvp

Try using the Following

尝试使用以下

window.open("http://localhost/123", '_blank');