在HTML <a> tag

时间:2016-09-28 13:33:50

标签: html5 hyperlink tabs anchor target

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 ...>)?

1 个答案:

答案 0 :(得分:1)

试试这个

<a href="www.stackoverflow.com" onclick="window.open('#','_blank');window.open(this.href,'_self');">
    linktext
</a>