window.open被IE拦截的解决办法
解决办法 open window IE 拦截
2023-09-14 08:58:27 时间
由于在使用window.open时,在很多情况下,弹出的窗口会被浏览器阻止,但若是使用a链接target='_blank',则不会,基于这一特点,自己封装了一个open方法:
function openwin(url) {
var a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.setAttribute("id", "openwin");
document.body.appendChild(a);
a.click();
}
使用方法:
在html页面里面添加<body></body>标签,如果已有,则不加。
在js块中,直接调用上面的openwin('url')即可。
转自:http://blog.csdn.net/fanfanjin/article/details/6858168
相关文章
- Centos6.4下安装protobuf-c问题及解决办法
- combogrid翻页后保持显示内容为配置的textField解决办法
- ajax+springmvc返回中文乱码的解决办法
- zblog上传安装主题插件不成功的原因和解决办法
- PCL 1.13.0——中文显示乱码解决办法
- django-vue-admin前端设置后台接口地址为127.0.0.1产生跨域问题解决办法
- win10微软账户登录后以管理员都无法修改hosts文件解决办法
- centos7 minimal运行vue项目npm run serve时报错:Error: spawn xdg-open ENOENT --解决办法:yum install xdg-utils
- git的reset重置:记录一次一键替换全部内容的作死事件和解决办法
- ubuntu上找不到wifi适配器,浏览器找不到服务器解决办法
- with root cause 解决办法
- Centos7安装JDK1.8【FinalShell终端本地文件上传失败解决办法】
- [MySQL] 解决办法:ibssl.so.10: cannot open shared object file: No such file or directory