0

When I use <a href="some url" target="_blank"> and when the user clicks the corresponding link, new tab opens and the user is directed to the new tab.

I want that new tab should open but user should remain on the previous tab only. In other words I want to emulate the Ctrl+click (or Cmd+click in Mac) behaviour.

Are there any such values for target attribute or are there any other attribute which can set such property to the links (<a ...>)?

unor
  • 87,575
  • 24
  • 195
  • 335
Shitanshu
  • 51
  • 2
  • 3
  • I saw a question that suggest to emulate the keyboard input http://stackoverflow.com/questions/10812628/open-a-new-tab-in-the-background – Pievis Sep 28 '16 at 13:48

1 Answers1

1

Try this

<a href="www.stackoverflow.com" onclick="window.open('#','_blank');window.open(this.href,'_self');">
    linktext
</a>
Roy123
  • 383
  • 4
  • 17
Bharat
  • 2,443
  • 3
  • 23
  • 35