下载属性在野生动物园中不起作用 [英] Download attribute not working in safari

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

问题描述

我在链接中使用了下载属性:

I am using a download attribute in my link:

   <a style="color:white" download="myimage" href="images/myimage.jpg">Download image</a>

它在几乎所有浏览器中都运行良好.这意味着,如果我单击链接,图像将自动下载.我在Mac上的safari 10.1.2中对其进行了测试,并且工作正常.

It is working very well in almost all browsers. This means, if I click on the link the image is automatically downloaded. I tested it in safari 10.1.2 on my mac and it is working fine.

但是在我的使用safari 10.0.3的朋友mac上,它不起作用.他说图像只是在新窗口中打开,而没有下载.

But on my friends mac who is working with safari 10.0.3 it is not working. He is saying that the image is only opening in a new window but not downloading.

为什么会发生这种情况,我该怎么做才能使其在任何地方都能正常工作?

Why is this happening and what can I do to make it work anywhere?

推荐答案

根据 https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_1.html ,它是在Safari 10.1中添加的:

According to https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_1.html, it was added in Safari 10.1:

HTML5下载属性 锚元素的下载属性 表示链接目标是一个下载链接,该下载链接会下载一个 文件,而不是导航链接.当您点击带有 download属性,将目标下载为文件. (可选) download属性的值提供了建议的名称 文件.

HTML5 Download Attribute The download attribute for anchor elements indicates that the link target is a download link that downloads a file, instead of a navigational link. When you click a a link with the download attribute, the target is downloaded as a file. Optionally, the value of the download attribute provides the suggested name of the file.

尽管从我自己的测试来看,它似乎在iOS Safari 11.1中似乎不可用,这让我有些困惑.基于它们相似的版本编号,我希望它们在标准支持方面是平等的.

It doesn't seem to be available in iOS Safari 11.1 though from my own testing, which has me a bit confused. I'd expect them to be equal in standards support, based on their similar version numbering.

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

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