1

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.

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351

3 Answers3

4

With just HTML:

<a href="www.targetpage.com" target="_blank"> Click here </a>

Documentation on target


You can also try with javascript (jQuery):

$('a.myLink').trigger(
    $.Event('click', {
        ctrlKey: true
    })
);

Documentation on Event

Jeffrey Roosendaal
  • 6,872
  • 8
  • 37
  • 55
2
<p> <a href="https://www.w3schools.com" target="_blank">click here</a></p>

use target="_blank" it will open the link in new tab

Gokulakrishnan M
  • 350
  • 4
  • 14
2

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