Ie downloads files in blob format without suffixes?

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);   
}

the project needs to be compatible with ie, and the download file is compatible with blob; the file can be downloaded but ie does not have a file suffix. Is there something wrong with my writing?


solve it on your own, fileName+'.pdf' can solve the demand together; is there any other solution? Or is that what ie is like?


fileName can get it directly from the reverse header.
let fileName = res.headers ['content-disposition'] .split (';') [1] .split ('=') [1]

Menu