在Interent Explorer中下载数据URI文件 [英] Data URI file download in Interent Explorer
问题描述
我有一个基于Web的应用程序,正在寻找一种方法,供用户从websql表中下载数据.有人建议使用数据URI,该数据URI在Internet Explorer之外的所有浏览器中似乎都适用.我采用的方法是将所有数据存储在变量中,并使用text/csv MIME-Type和charset = UTF-8字符集编码:
I have a web based application and was looking for a way for users to download their data from the websql tables. Someone suggested using data URI which seems to work in all browsers but Internet Explorer. The approach I am taking is to store all data in a variable and using text/csv MIME-Type and charset=UTF-8 character set encoding:
document.location.href = 'data:text/csv;charset=UTF-8,' + encodeURIComponent(info);
但是,当我单击Internet Explorer 9中的链接时,它说无法显示该页面.任何想法如何使它在IE中工作?谢谢.
However when I click the link in internet explorer 9 it says the page can not be displayed. Any ideas how to get this working in IE? Thanks.
推荐答案
IE8和IE9仅支持图像的数据URI.在此处阅读有关IE对数据URI的支持的更多信息:
IE8 and IE9 only support the data URI for images. Read more about IE's support for the data URI here:
http://msdn.microsoft.com /en-us/library/cc848897(v=vs.85).aspx
您可以尝试一些针对IE的Flash hack.将数据传递给闪存.使用AS3启动下载.
You could try some kinda flash hack for IE. Pass the data to flash. Use AS3 to initiate a download.
这篇关于在Interent Explorer中下载数据URI文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!