Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I tried this code

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

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

like image 824
liamzebedee Avatar asked Jan 21 '23 03:01

liamzebedee


1 Answers

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.

like image 99
Dave Avatar answered Jan 23 '23 23:01

Dave