当用户点击 chrome 扩展程序中的某个网址时打开一个新标签页
Opening a new tab when user clicks on some url in chrome extension
我写了一个chrome扩展。我希望当用户单击它而不在 onclick 中使用 target=_blank 时,所有 url 都能在新选项卡中打开,因为这对我来说是乏味的工作。
任何建议将不胜感激。
提前谢谢。
$(document).click(function(e) {
// Check for button click
if (e.button == 0) { // left click
window.open('http://google.com');
}
else if (e.button == 3){//right click
window.open('http://yahoo.com');
}
});
希望这对你有帮助
相关文章: