Can cross-domain download files with a tag be automatically renamed when clicking download?
The file is not on my server
I don’t want to save this file on my server
Is there a way for users to automatically rename the file name when downloading by clicking the a tag?
You can use the HTML5
中的download
attribute, refer to w3school:
<a download="baidu">
location /imgProxy {
resolver 10.0.0.1;
proxy_pass $arg_url;
}
<a href="/imgProxy?url=https://static.segmentfault.com/v-5922866b/global/img/logo-b.svg" download="logo">segmentfault</a>
Currently only Chrome supports this feature:
<a href="..." download="file.mp4">Download</a>