How can I open a new tab using javascript without switching to the new tab? For example, when a user clicks on a link a new tab is to be opened, but the user should stay
The web browser automatically focuses on the new tab, but you can call the focus back:
function openWindow( url ) { window.open(url, '_blank'); window.focus(); } Click Me