Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
468 views
in Technique[技术] by (71.8m points)

javascript - JavaScript在新窗口中打开,而不是选项卡(JavaScript open in a new window, not tab)

I have a select box that calls window.open(url) when an item is selected.

(我有一个选择框,当选择一个项目时,它会调用window.open(url) 。)

Firefox will open the page in a new tab by default.

(Firefox默认会在新标签页中打开页面。)

However, I would like the page to open in a new window, not a new tab.

(但是,我希望页面在新窗口中打开,而不是在新标签页中打开。)

How can I accomplish this?

(我该怎么做?)

  ask by adam translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Give the window a 'specs' parameter with width/height.

(给窗口一个“ specs”参数,该参数具有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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...