遇见问题: ios中1.token失效页面打不开 感觉应该是ios拦截了; 安卓是没有问题的; 不过注意: 大文件下载很慢,耐心等待
function download(src) {
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {
var fileURL = window.open(src, "_blank", "height=0,width=0,toolbar=no,menubar=no,scrollbars=no,resizable=on,location=no,status=no");
fileURL.document.execCommand("SaveAs");
fileURL.window.close();
fileURL.close();
} else if (window.navigator.msSaveBlob) {
window.open(src);
} else {
var $a = document.createElement('a');
$a.setAttribute("href", src);
$a.setAttribute("download", "");
var evObj = document.createEvent('MouseEvents');
evObj.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
$a.dispatchEvent(evObj);
}
}
————————————————
原文链接:https://blog.csdn.net/iamTab/article/details/109595587