any clean ways to download files like html5 download attribute

前端 未结 2 1498
不思量自难忘°
不思量自难忘° 2021-02-12 21:15

I am fully aware that there are many debates(and solutions) out there in terms of downloading files in javascript/jQuery, such as iFrame, jQueryPlugin.

相关标签:
2条回答
  • 2021-02-12 21:38

    There is Downloadify, which generates and force downloads files with Flash. There's also a demo available.

    Or you could download the file using XHttpRequest ($.get in jQuery) and use data URIs.

    0 讨论(0)
  • 2021-02-12 21:42

    You might want to try FileSaver.js which has support for all modern browsers.

    var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
    saveAs(blob, "hello world.txt");
    
    0 讨论(0)
提交回复
热议问题