How do you open a new tab in chrome using HTML/JS?

前端 未结 3 1989
夕颜
夕颜 2020-12-21 02:17

I tried this code

window.open(\'page2.html\',\'_newtab\');

And all it opened was a new window. How do I open a new tab?

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 02:38

    I don't think you can, from HTML / Javascript, indicate that a page should be opened in a new tab.

    (In fact, your page might be opened to a new window, or to a new tab, depending on the configuration of the browser)

提交回复
热议问题