我需要使用标签下载.csv文件。 该解决方案现在可以在Chrome,Firefox中运行,但不能在IE,Safari中运行。
我正在使用:
<a download href="api url">Download</a>
IE和Safari不支持属性下载。
我找到了JS库文件保存器,但它需要 blob 文件。
现在,我需要从api网址创建blob文件,然后使用文件保护程序下载。
更新:
一个有趣的细节:例如,当我直接在浏览器中打开url时: example.com/docs/files (不带文件扩展名!)。我收到404页面未找到。但是,当我使用<a DOWNLOAD href="https://example.com/docs/files">Download</a>
时,它可以正常工作,文件被下载,没有打开新页面
答案 0 :(得分:0)
Internet Explorer当前不支持Download
标记上的A
属性。
请参见http://caniuse.com/download和http://status.modern.ie/adownloadattribute;后者表示该功能是IE12的“正在考虑中”。