[jQuery]下载链接文件

function downloadFile(url, fileName) {
    var x = new XMLHttpRequest();
    x.open("GET", url, true);
    x.responseType = 'blob';
    x.onload = function (e) {
        var url = window.URL.createObjectURL(x.response)
        var a = document.createElement('a');
        a.href = url
        a.download = fileName;
        a.click()
    }
    x.send();
}

 

上一篇:阿里云发布新版SaaS上云工具包,全面助力SaaS上云


下一篇:2021-05-06