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

 ̄綄美尐妖づ 提交于 2020-01-28 10:45:50

问题


I tried this code

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

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


回答1:


This is a browser setting and not something you can control with code. In my browser, your "window.open" will open a new tab, because that's what I have mine set up to do. In others' browsers, it might open a new window.




回答2:


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)




回答3:


You can do this easily. See the answer here.



来源:https://stackoverflow.com/questions/5495328/how-do-you-open-a-new-tab-in-chrome-using-html-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!