Data URI doesn't work with IE

前端 未结 2 802
暗喜
暗喜 2020-12-11 20:56

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 somethi

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-11 21:29

    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!

提交回复
热议问题