标签(空格分隔): js

在此输入正文

<script type="text/javascript">
    function download(filename) {
        var oReq = new XMLHttpRequest();
        oReq.open("GET", "<你的返回流的Action路径>", true);
        oReq.responseType = "blob";
        oReq.onload = function (oEvent) {
            var content = oReq.response;

            var elink = document.createElement('a');
            elink.download = filename;
            elink.style.display = 'none';

            var blob = new Blob([content]);
            elink.href = URL.createObjectURL(blob);

            document.body.appendChild(elink);
            elink.click();

            document.body.removeChild(elink);
        };
        oReq.send();
    }
</script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-11-14
  • 2021-12-09
  • 2021-07-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2022-01-21
相关资源
相似解决方案