I'm trying to convert json to csv, based on this post. Everything works fine in Chrome and Firefox except IE10. Window.open
doesn't seem to work in IE10.
window.open( "data:text/csv;charset=utf-8," + escape(str));
where str
is my csv string
A new blank tab is opened with url "data:text/csv;charset=utf-8,xxxxxxxxxxxx"
where "xxxx"
is the encoded csv string.
I have also tried:
var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str);
var downloadLink = document.createElement("a");
downloadLink.href = uri;
downloadLink.download = "OpHis.csv";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
with same result working in Chrome, Firefox but not in IE10. Any help is appreciated.