Is there a way to create a link using JavaScript that acts exactly like an <a>
tag? In other words, when you click it normally, it opens in the current window and when you right click, it shows "Open link in a new tab" under options. And if you click it, it does open in a new tab.
I am not interested in solutions that add an <a>
tag into the html, because the main reason I am asking this is that I need to apply this link to a <tr>
element.
Edit: Please consider that this needs to work with keyboard shorcuts (such as cmd+click on a mac) as well as right click and "Open in new tab"
Use window.open(url, '_blank')
to open it a new target window