-3

I have got a task to open the link in a new tab.For that I tried the below code

window.open($(this).attr("data-MenuLink"), 'target=_new');

and also window.open($(this).attr("data-MenuLink"), 'target=_blank');

But the problem is that when I click on the first time, it will load on new tab and work properly. But on second time it will just reload on the previously created tab, rather than new one. I need to open the window in new tab on each click

Damien Overeem
  • 4,487
  • 4
  • 36
  • 55
Nithin Viswanathan
  • 3,245
  • 7
  • 39
  • 84

4 Answers4

0
window.open('www.yourdomain.com','_blank');
Taryn
  • 242,637
  • 56
  • 362
  • 405
Hazem Hagrass
  • 9,329
  • 10
  • 32
  • 54
0
window.open('http://www.yahoo.com','_blank','width=600,height=600')
Taryn
  • 242,637
  • 56
  • 362
  • 405
Alok Nath
  • 141
  • 1
  • 6
0

CSS3 supports "open in new tab", by the property

target-new: window | tab | none;

See this

Otherwise, you can use the browser properties to force windows to open in a new tab.

EDIT: It does not seem to be supported by any browser currently. This seems to work in firefox

<a href="some url" target="_newtab">content of the anchor</a>

Else, use this method to resize window immediately, to ensure that popup blockers do not kill your popup

0

Hi Try This code,

 <a href="some url" target="_blank">content of the anchor</a>
rohitr
  • 371
  • 2
  • 11