我正在尝试在我的 html 上添加下载链接。但是当我下载文件时,文件扩展名不正确。它只是显示 File
而不是 csv
文件类型。
<a href="test.csv" download="filename">Download link</a>
我做错了什么?
最佳答案
The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.
This attribute is only used if the href attribute is set.
The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).
If the value is omitted, the original filename is used.
https://www.w3schools.com/tags/att_a_download.asp
<a href="test.csv" download>Download link</a>
关于javascript - HTML 下载的文件类型不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48178221/