JavaScript在新窗口中打开,而不是选项卡 [英] JavaScript open in a new window, not tab

查看:121
本文介绍了JavaScript在新窗口中打开,而不是选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个选择框,当选择一个项目时调用 window.open(url)。 Firefox将在默认情况下在新标签页中打开页面。但是,我希望页面在新窗口中打开,而不是新的选项卡。



我怎样才能做到这一点?解析方案

给窗口一个规格参数与宽度/高度。有关所有可能的选项,请参见此处。 / p>

  window.open(url,windowName,height = 200,width = 200); 

当您指定宽度/高度时,将会在新窗口而不是选项卡中打开它。

I have a select box that calls window.open(url) when an item is selected. Firefox will open the page in a new tab by default. However, I would like the page to open in a new window, not a new tab.

How can I accomplish this?

解决方案

Give the window a 'specs' parameter with width/height. See here for all the possible options.

window.open(url, windowName, "height=200,width=200");

When you specify a width/height, it will open it in a new window instead of a tab.

这篇关于JavaScript在新窗口中打开,而不是选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆