解决弹出的窗口window.open会被浏览器阻止的问题
方法-: 在js中不采用window.open方法,采用window.location.href = url;
方法二:自定义方法:
function openwin(url) {
var a = document.createElement_x("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.setAttribute("id", "openwin");
document.body.appendChild(a);
a.click();
}
var a = document.createElement_x("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.setAttribute("id", "openwin");
document.body.appendChild(a);
a.click();
}
posted on 2013-08-29 09:33 taian_xiaojia 阅读(187) 评论(0) 收藏 举报
浙公网安备 33010602011771号