创建a标签模拟点击实现新窗口,避免被浏览器拦截
function openLink(url, target) {
var a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('target', target || '_blank');
document.body.appendChild(a);
a.click();
}
创建a标签模拟点击实现新窗口,避免被浏览器拦截
function openLink(url, target) {
var a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('target', target || '_blank');
document.body.appendChild(a);
a.click();
}