Chrome 下载属性不起作用 [英] Chrome Download Attribute not working
问题描述
自从最新版本以来,我遇到了一些意想不到的 Chrome 行为:在 Firefox 中,此代码运行良好:
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>
它在 Chrome 中不起作用(只需下载一个名为下载"的文件),但之前运行得很好.我需要改变什么才能让它再次工作?
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.
如果 HTTP 标头 Content-Disposition: 存在并给出与此属性不同的文件名,则 HTTP 标头优先于此属性.
If the HTTP header Content-Disposition: is present and gives a different filename than this attribute, the HTTP header has priority over this attribute.
如果此属性存在且 Content-Disposition: 设置为 inline,则 Firefox 优先考虑 Content-Disposition,就像文件名大小写一样,而 Chrome 优先考虑下载属性.
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
HTTP-Header Content-Disposition
这篇关于Chrome 下载属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!