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

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

问题描述

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

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?

推荐答案

指定窗口功能"到 open 调用:

Specify window "features" to the open call:

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.

参见 https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features 所有可能的功能.

See https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features for all the possible features.

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

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