html5 work,HTML5 Download Attribute doesn't work

一般这个h5重新命名下载文件名称的属性没有生效,应该是后台的HTTP header设置了Content-Disposition了,

比如在python,在下载文件的时候写了如下代码:

resp.headers["Content-Type"] = "application/octet-stream"

resp.headers["Content-Disposition"] = "attachment; filename={0};".format(ret[1])

把Content-Disposition删除掉就可以了

当然这个功能只适合在同源下进行

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.

This attribute is only honored for links to resources with the same-origin.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值