How to stay on current window when the link opens in new 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);
}

Leave a Comment