Chrome下载属性不起作用 [英] Chrome Download Attribute not working
问题描述
从最新版本开始,我经历了Chrome的一些意外行为:
在Firefox中,此代码运行良好:
< a id =playlistclass =buttondownload =Name.xspfhref =data:application / octet-stream; base64,PD94ANDSOONstyle =display:inline;>下载我< / a>
它在Chrome中不起作用(只需下载名为Download的文件),但已运行之前很好。我有什么改变,它是工作了?
经过一番研究,我终于找到你的问题。
< a>下载属性:
如果HTTP报头内容处置:是本并给出了一个不同的文件名比这个属性,HTTP报头移到该属性具有优先
如果存在该属性和内容处置:被设置为内联,火狐优先内容处置,像的文件名的情况下,而铬优先到下载属性<。 / p>
HTTP-Header 内容处理
I've experienced some unexpected behavior of Chrome since the newest version: While in Firefox this Code is working Perfectly fine:
<a id="playlist" class="button" download="Name.xspf" href="data:application/octet-stream;base64,PD94ANDSOON" style="display: inline;">Download Me</a>
It isn't working in Chrome (Simply downloading a file named "Download"), but has worked pretty fine before. What do I have to change that it is working again?
After some research I have finally found your problem.
<a> download attribute:
If the HTTP header Content-Disposition: is present and gives a different filename than this attribute, the HTTP header has priority over this attribute.
If this attribute is present and Content-Disposition: is set to inline, Firefox gives priority to Content-Disposition, like for the filename case, while Chrome gives priority to the download attribute.
HTTP-Header Content-Disposition
这篇关于Chrome下载属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!