JavaScript open in a new window, not tab

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

    For me the solution was to have

    "location=0"
    

    in the 3rd parameter. Tested on latest FF/Chrome and an old version of IE11

    Full method call I use is below (As I like to use a variable width):

    window.open(url, "window" + id, 'toolbar=0,location=0,scrollbars=1,statusbar=1,menubar=0,resizable=1,width=' + width + ',height=800,left=100,top=50');
    

提交回复
热议问题