liamzebedee
liamzebedee

Reputation: 14490

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?

Upvotes: 4

Views: 20645

Answers (3)

Carl Younger
Carl Younger

Reputation: 3070

You can do this easily. See the answer here.

Upvotes: 0

Dave
Dave

Reputation: 29141

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.

Upvotes: 10

Pascal MARTIN
Pascal MARTIN

Reputation: 401142

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)

Upvotes: -1

Related Questions