4

I tried this code

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

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

liamzebedee
  • 14,010
  • 21
  • 72
  • 118
  • 1
    possible duplicate of [Programmatically open new pages on Tabs](http://stackoverflow.com/questions/427479/programmatically-open-new-pages-on-tabs) – zzzzBov Mar 31 '11 at 04:41

3 Answers3

10

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.

Dave
  • 28,833
  • 23
  • 113
  • 183
0

You can do this easily. See the answer here.

Community
  • 1
  • 1
Carl Smith
  • 3,025
  • 24
  • 36
-1

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)

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663