JavaScript open in a new window, not tab

前端 未结 15 1519
余生分开走
余生分开走 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条回答
  •  萌比男神i
    2020-11-21 22:46

    Interestingly, I found that if you pass in an empty string (as opposed to a null string, or a list of properties) for the third attribute of window.open, it would open in a new tab for Chrome, Firefox, and IE. If absent, the behavior was different.

    So, this is my new call:

     window.open(url, windowName, '');
    

提交回复
热议问题