简体   繁体   English

JavaScript怎么打开弹窗? (不是 window.open)

[英]How to open popup in JavaScript? (NOT window.open)

This is kind of a dumb question, but what is the command to open a popup window in JS?这是一个愚蠢的问题,但是在 JS 中打开弹出窗口 window 的命令是什么? I know that window.open works, but on chrome, it shows the tabs, which I have seen in popups not existing.我知道 window.open 有效,但在 chrome 上,它显示了我在不存在的弹出窗口中看到的选项卡。 It should just show the address at the top.它应该只在顶部显示地址。 Hopefully I expressed this question correctly.希望我正确表达了这个问题。

Default behavior is to open in a new tab.默认行为是在新选项卡中打开。 However, using the third parameter windowFeatures in the window.open(...);但是,在window.open(...);中使用了第三个参数windowFeatures function will allow you to set parameters to force the request to open in a new popup with the minimal UI elements that you're requesting. function 将允许您设置参数以强制请求在新的弹出窗口中打开,其中包含您请求的最少 UI 元素。 For example:例如:

window.open("{url}", "_blank", "popup=yes");

Reference Documentation: window.open()参考文档: window.open()

Specifying the popup option in the windowsFeatures (third) parameter should produce the result you want.windowsFeatures (第三个)参数中指定popup选项应该会产生您想要的结果。

window.open('', '', 'popup=true')

Learn more about window.open from MDN, here.在此处从 MDN 了解有关window.open的更多信息。

Hope this helps.希望这可以帮助。

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

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