JavaScript open in a new window, not tab

前端 未结 15 1284
余生分开走
余生分开走 2020-11-21 22:18

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 t

15条回答
  •  盖世英雄少女心
    2020-11-21 23:11

    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.

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

提交回复
热议问题