function getFileDownLoad(fileData,fileName){
let blob = new Blob([fileData],{type:"application/pdf"});
// for ie 10+
if (window.navigator.msSaveBlob) {
window.navigator.msSaveOrOpenBlob(blob,fileName);
return;
}
//google
let elink = document.createElement('a');
elink.href = URL.createObjectURL(blob);
elink.download = fileName;
document.body.appendChild(elink);
elink.click()
URL.revokeObjectURL(elink.href);
document.body.removeChild(elink);
}
项目需要兼容ie,下载文件采用blob的形式兼容;文件可以下载但是ie没有文件后缀名,是我的写法有问题吗?
自己解决了,fileName+'.pdf' 拼起来能解决需求; 有没有别的解决方法呢? 还是ie就是这样的??