window.open被拦截的解决方案
Posted 野生java研究僧
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了window.open被拦截的解决方案相关的知识,希望对你有一定的参考价值。
/**
* 在用户触发操作后回调该函数即可跳转
* @param Object url 需要跳转的连接
* @param Object id 元素id
*/
function windowOpen(url, id)
var a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('target', '_blank');
a.setAttribute('id', id);
if (!document.getElementById(id)) document.body.appendChild(a);
a.click();
a.remove();
以上是关于window.open被拦截的解决方案的主要内容,如果未能解决你的问题,请参考以下文章