Data URI file download in Interent Explorer

て烟熏妆下的殇ゞ 提交于 2019-12-02 00:09:13

问题


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);

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.


回答1:


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

EDIT: You could try some kinda flash hack for IE. Pass the data to flash. Use AS3 to initiate a download.



来源:https://stackoverflow.com/questions/12042847/data-uri-file-download-in-interent-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!