Data Uri Doesn't Work With Ie
Im trying to dynamically create a CSV file using javascript that the user can download. This only has to work in IE. The html the javascript generates looks something like this
Solution 1:
Internet Explorer 10 doesn't support the data
protocol on the a
element. Per the documentation, the only supported elements/attributes are the following:
- object (images only)
- img
- input type=image
- link
- CSS declarations that accept a URL, such as background, backgroundImage, and so on.
You should know that what you're attempting to do smells like a phishing attempt; for this reason you shouldn't expect browsers to support this pattern. You can read more about data-uri phishing in the paper Phishing by data URI.
Solution 2:
I had the same problem, I download the data uri in this way with Chrome:
var link = document.createElement("a");
link.download = dataItem.Filename;
link.href = data;
link.click();
But it does not work in Internet Explorer. I have found a library that works in Internet Explorer, https://github.com/rndme/download
The only issue for me is the dowload of files with longer MIME type like odt, docx, etc. For all the other kind of files it look great!
Post a Comment for "Data Uri Doesn't Work With Ie"