下载标签不在IE中工作 [英] Download attribute on A tag not working in IE
本文介绍了下载标签不在IE中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从下面的代码中,我创建了一个下载文件的动态锚标签。此代码在Chrome中运行良好,但不在IE中。我怎样才能做到这一点
< div id =divContainer>
< h3>样本标题< / h3>
< / div>
< button onclick =clicker()>点击我< /按钮>
< script type =text / javascript>
函数clicker(){
var anchorTag = document.createElement('a');
anchorTag.href =http://cdn1.dailymirror.lk/media/images/finance.jpg;
anchorTag.download =下载;
anchorTag.click();
var element = document.getElementById('divContainer');
element.appendChild(anchorTag);
}
< / script>
解决方案
Internet Explorer目前不支持在
属性。 A
标签上下载
请参阅 http://caniuse.com/download 和http://status.modern.ie/adownloadattribute ;后者表示IE12的功能是正在考虑中。
From the following code I'm creating a dynamic anchor tag which downloads a file. This code works well in Chrome but not in IE. How can I get this working
<div id="divContainer">
<h3>Sample title</h3>
</div>
<button onclick="clicker()">Click me</button>
<script type="text/javascript">
function clicker() {
var anchorTag = document.createElement('a');
anchorTag.href = "http://cdn1.dailymirror.lk/media/images/finance.jpg";
anchorTag.download = "download";
anchorTag.click();
var element = document.getElementById('divContainer');
element.appendChild(anchorTag);
}
</script>
解决方案
Internet Explorer does not presently support the Download
attribute on A
tags.
See http://caniuse.com/download and http://status.modern.ie/adownloadattribute; the latter indicates that the feature is "Under consideration" for IE12.
这篇关于下载标签不在IE中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文