I’m trying to force a link to open in a new tab - is this possible? If I use the target=blank attribute then the default behaviour in most browsers is to open in a new window, so I’m trying to simulate a middle click (this is for an internal page so I’m not too bothered about annoying browsers).
I thought if I capture a left click event and modify the ‘which’ attribute, then re-trigger the event, this might work:
$('#mylink').click(function(e){
if(e.which==1) e.preventDefault();
e.which=2;
$('#mylink').trigger( e );
});
But nothing happens. Is it even possible? Any suggestions as to how to do it?