Chrome下载属性不起作用 [英] Chrome Download Attribute not working

查看:151
本文介绍了Chrome下载属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从最新版本开始,我经历了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.

Source

HTTP-Header Content-Disposition

这篇关于Chrome下载属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆