最佳答案
我找到了这个解决方案
<script type='text/javascript'>
jQuery(function($){
$('a').mousedown(function(event) {
switch (event.which) {
case 1:
//alert('Left mouse button pressed');
$(this).attr('target','_self');
break;
case 2:
//alert('Middle mouse button pressed');
$(this).attr('target','_blank');
break;
case 3:
//alert('Right mouse button pressed');
$(this).attr('target','_blank');
break;
default:
//alert('You have a strange mouse');
$(this).attr('target','_self"');
}
});
});
关于javascript - 是否可以使用 javascript 捕获上下文菜单的 "Open in New Tab"单击事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49228640/