How to stay on current window when the link opens in new tab?

<a href="www.stackoverflow.com" onclick="window.open('#','_blank');window.open(this.href,'_self');">

This will load the current web page in a new tab which the browser will focus on, and then load the href in the current tab


I guess target="_blank" would open new tab/Windows but will switch the tab as well, and no way I can find them stuff in html, Yes but when we click in link pressing control key it opens the link in new background tab, Using javascript we can stimulate same Here is code I found

function openNewBackgroundTab(){    
    var a = document.createElement("a");    
    a.href = "http://www.google.com/";    
    var evt = document.createEvent("MouseEvents");    

    //the tenth parameter of initMouseEvent sets ctrl key    
    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,true, false, false, false, 0, null);    
    a.dispatchEvent(evt);
}

Tags:

Html

Jquery