我想单击按钮打开新选项卡,但总是打开新窗口:
window.open(my_id + '/edit/', '_blank', 'rel="noopener"')
要求使用rel =“noopener”
最佳答案
我认为以下代码将帮助您解决问题
window.open('_link is here_', 'name');
或者您也可以尝试这种方法
var win = window.open('https://www.google.co.in/', '_blank');
if (win) {
//Browser has allowed it to be opened
win.focus();
} else {
//Browser has blocked it
alert('Please allow popups for this website');
}