JavaScript open in a new window, not tab

前端 未结 15 1326
余生分开走
余生分开走 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:09

    You don't need to use height, just make sure you use _blank, Without it, it opens in a new tab.

    For a empty window:

    window.open('', '_blank', 'toolbar=0,location=0,menubar=0');
    

    For a specific URL:

    window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');
    

提交回复
热议问题