function ikkatuPdf(pdfArray,i){
var pdfId = "KBT-5010";
var filePath = $(pdfArray[i]).val();
var mimeType = "text/html";
if(pdfArray.length == i){
return false;
}else{
window.location.href='${pageContext.request.contextPath}/cm/download?gamenId='+pdfId+'&path='+filePath+'&fileName='+pdfName(filePath, i)+'&mimeType='+mimeType;
i++;
ikkatuPdf(pdfArray,i);
}
}
用下面方式下载文件
var aLink = document.createElement('a');
aLink.download = "文件名";
aLink.href = "文件url地址";
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink);
页面跳转和下载是异步的
window.location.href='${pageContext.request.contextPath}/cm/download?gamenId='+pdfId+'&path='+filePath+'&fileName='+pdfName(filePath, i)+'&mimeType='+mimeType;
你还没来得及跳转呢,你又下一个了。
正确的做法是不要跳转,而是弹窗,不过首先要让浏览器允许弹窗。
并不支持兼容模式