Javascript重命名下载文件 [英] Javascript rename file on download
本文介绍了Javascript重命名下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够下载网络文件,但是当下载对话框打开时,文件名被重命名.
I want to be able to download a web file, but when the download dialog open, the filename is renamed.
例如:文件:http://
当我点击下载文件时,下载对话框打开,文件名:test001.txt
.
and when I click to download the file, download dialog open with the file name: test001.txt
.
我怎样才能做到这一点?
How can I achive that?
推荐答案
正如 InviS 所建议的,现在链接上有一个 download
属性.
As InviS suggests, now there's a download
attribute on links.
示例:
<a href="http://server/site/test.txt" download="test001.txt">Download Your File</a>
查看全文