1

Although this question is similar to my question, but my requirement is we have to only use HTML.

<a href="https://stackoverflow.com/" target="_blank">Stack Overflow</a>

If we use above code then it opens Stack Overflow website in new tab but focus will move to Stack Overflow website. My requirement is focus should still remain in current tab and it should open Stack Overflow website.

Basically I want Open link in new tab or Ctrl+Left_click feature in HTML.

Jack
  • 11
  • 2

2 Answers2

1

HTML provides no mechanism for the website developer to control this.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
-1

Unfortunately I Don't think there's an API to do this. But the browsers have a defualt behaviour that you if you click on any link along with control button pressed it will open the new tab and focus will remain of existing tab.

As a workaround, you can try simulating Ctrl+Click using JS on an anchor tag created.

https://stackoverflow.com/a/11389138/13218645

Rohit Sngh
  • 19
  • 8