This is a trick,
function openInNewTab(url) { window.open(url, '_blank').focus(); } // Or just window.open(url, '_blank').focus(); function openInNewTab(url) { window.open(url, '_blank').focus(); } // Or just window.open(url, '_blank').focus(); In most cases, this should happen directly in the onclick handler for the link to prevent pop-up blockers, and the default "new window" behavior. You could do it this way, or by adding an event listener to your DOM object.
<div onclick="openInNewTab('www.test.com');">Something To Click On</div> <div onclick="openInNewTab('www.test.com');">Something To Click On</div> Reference: Open a URL in a new tab using JavaScript