Reputation: 13110
Can I force click on hyperlink to open in new page when click on link?
My page is part of a frameset, and links to one site has changed so it prevents the link working if comes form a frameset, but its fine if user does does cntl-click to open page in new tab.
But user doesn't know that so I want a usual click to open in new tab as well to workaround this issue.
Upvotes: 1
Views: 4834
Reputation: 7157
With just HTML:
<a href="www.targetpage.com" target="_blank"> Click here </a>
You can also try with javascript (jQuery):
$('a.myLink').trigger(
$.Event('click', {
ctrlKey: true
})
);
Upvotes: 4
Reputation:
Use target="_blank" inside your link tag:
<a href="link" title="link title" target="_blank">link title</a>
See: https://www.w3schools.com/tags/att_a_target.asp
Upvotes: 2
Reputation: 360
<p> <a href="https://www.w3schools.com" target="_blank">click here</a></p>
use target="_blank" it will open the link in new tab
Upvotes: 2