//下载多个文件
function downFileMulti(list) {
list.forEach(function (url) {
if (this.isIE()) { // IE
window.open(url, '_blank');
} else {
var a = document.createElement('a'); // 创建a标签
var e = document.createEvent('MouseEvents'); // 创建鼠标事件对象
e.initEvent('click', false, false); // 初始化事件对象
a.href = url; // 设置下载地址
a.download = ''; // 设置下载文件名
a.dispatchEvent(e);
}
})
}
//判断是否是ie
function isIE(){
if (!!window.ActiveXObject || 'ActiveXObject' in window) {
return true;
} else {
return false;
}
}
注:以上方法适用于域名一样的情况,域名不一样会被禁止;并且域名网站需要时https