0

So I have a very simple link that tries to open 2 new tabs:

function multipleTabs() {
  window.open("http://firstlink/","_blank"); 
  window.open("http://secondlink/","_blank");
  
  return false;
}
<a href="javascript:void(0);" onclick="multipleTabs();">Open 2 tabs</a>

The issue is that when I click the link, the 2 tabs are opened fine but it appears another blank new tab, for a total of 3 new tabs.

How can I prevent the third blank tab to be opened?
Note: you have to allow the pop up in your chrome page to make this working

PS. the solution can be also just chrome specific as I don't use other browser for this page.

giò
  • 3,402
  • 7
  • 27
  • 54

1 Answers1

0

Try:

<a href="javascript:multipleTabs()">Open 2 tabs</a>

I usually avoid using javascript:void(0) as long as I can for avoiding this type of issues, however for some reason both works-for-me.

user1039663
  • 1,230
  • 1
  • 9
  • 15