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?
仅有的幸福2017-05-24 11:35:26
You can use the HTML5
中的download
attribute, refer to w3school:
<a href="https://www.baidu.com/img/bd_logo1.png" 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>
PHPz2017-05-24 11:35:26
Currently only Chrome supports this feature:
<a href="..." download="file.mp4">Download</a>