简体   繁体   English

window.open在新标签页而不是弹出窗口中打开页面

[英]window.open open the page in a new tab instead of in popup window

i'm trying to open popup window this this jscript: window.open(myUrl, ""); 我正在尝试用这个jscript打开弹出窗口:window.open(myUrl,“”); for some users the page appears in a new tab, but I want it in a popup window. 对于某些用户,页面显示在新选项卡中,但我希望它在弹出窗口中。 maybe someone know any reason for it? 也许有人知道原因吗?

For the most part, this is a configuration setting in most modern browsers that the user controls. 在大多数情况下,这是用户控制的大多数现代浏览器中的配置设置。 However, if you specify window dimensions and/or features on the window.open call, some browsers may open a new window when they otherwise would have opened a new tab. 但是,如果您在window.open调用中指定了窗口尺寸和/或功能,则某些浏览器可能会打开新窗口,否则会打开新窗口。 For example: 例如:

window.open("mypage", "_blank", "width=400,height=200,menubar=no,toolbar=no");

At the end of the day, though, it's stil down to the browser implementation, and as ever, you'll need to test to ensure you're getting the results you hope for across the majority of browsers your app/site supports/typically sees. 不过,归根结底,这取决于浏览器的实现,而且像往常一样,您需要进行测试以确保在您的应用程序/网站支持/通常在大多数浏览器上都能获得希望的结果看到。

This article might be of help: http://www.blazonry.com/javascript/windows.php . 本文可能会有所帮助: http : //www.blazonry.com/javascript/windows.php You need to specify size attributes. 您需要指定尺寸属性。

window.open(myUrl, "_blank", "width=640,height=480,menubar=no,toolbar=no");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM