[英]html5 href download attribute issue
直到今天,这是在Chrome上生成客户端的KML文件:
<script>
var kmlText = 'kml code here';
var link = document.createElement("a");
link.setAttribute("href", 'data:text/plain,' + kmlText);
link.setAttribute("download", "Export.kml");
link.innerHTML = "Download KML";
document.getElementById("myDIV").appendChild(link);
</script>
<html>
<div id="myDIV">Download</div>
</html>
从最近链接将强制下载,但不接受Chrome上的文件名和扩展名,默认为'Download.txt'..在Firefox上它正常工作,就像之前在Chrome上一样..
有人有线索吗?
它看起来像铬中的一个bug。 我无法在桌面上重现它。
您应该在此处提交错误: https : //code.google.com/p/chromium/issues/list
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.