1

Using this below code I am able to open new tab along with the URL..in Firefox..but same code when I am trying to open in Chrome its opening new window which I don't want new window ..I want new tab in case of chrome

Here is my code:

> window.open(this.getJavaURL +
                        ((this.returnPage != null) ?
                        ('&returnPage=' + this.returnPage) : '') +
                        ((this.locale != null) ?
                        ('&locale=' + this.locale) : '') +
                        ((this.brand != null) ?
                     ('&brand=' + this.brand) : ''),'_new');

Can you please help me..

Pranav Singh
  • 17,079
  • 30
  • 77
  • 104
Manoj
  • 11
  • 1
  • 1
  • 3
  • 1
    Instead of "_new", you can use "_newtab" – knshn Jun 27 '13 at 09:38
  • I tried with that but still i am getting the new window.. – Manoj Jun 27 '13 at 09:42
  • 2
    This depends on the browser settings, you can't probably change this: http://stackoverflow.com/a/4907854/1935077 – Petr R. Jun 27 '13 at 09:55
  • possible duplicate of [Open url in new tab using javascript](http://stackoverflow.com/questions/4907843/open-url-in-new-tab-using-javascript) – sra Dec 03 '13 at 10:01

4 Answers4

0

Use _blank instead of "_new"

It will instruct the browser to create a new browser tab or window when the user clicks on the link.

As per reference: _new is not valid

Demo: http://jsfiddle.net/eH9tw/

Satpal
  • 132,252
  • 13
  • 159
  • 168
0

It's work for me. Just

    window.open('http://google.com');   

http://jsfiddle.net/HFeQj/

z1m.in
  • 1,661
  • 13
  • 19
0

Wether a new window or new tab is openend is based upon your browser configuration, within the browser you can set to always open popups in new tabs.

_new might break it and always open a window, _blank is the way to go like Satpal says

Samantha Adrichem
  • 833
  • 1
  • 12
  • 23
0

it is depends on chrome and firefox tab setting.

For open new tab, you can write as below:

 window.open('http://google.com');

if new tab set as new window then it will open in new window, else it will open in new tab.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Amit
  • 15,217
  • 8
  • 46
  • 68