Fix broken download in Edge

Closes #75
This commit is contained in:
chylex 2019-09-05 21:55:42 +02:00
parent 9c8db2546e
commit 05c764e486

View File

@ -63,7 +63,13 @@ var DOM = (function(){
* Triggers a UTF-8 text file download.
*/
downloadTextFile: (fileName, fileContents) => {
var url = window.URL.createObjectURL(new Blob([fileContents], { "type": "octet/stream" }));
var blob = new Blob([fileContents], { "type": "octet/stream" });
if (window.navigator.msSaveBlob){
return window.navigator.msSaveBlob(blob, fileName);
}
var url = window.URL.createObjectURL(blob);
var ele = createElement("a", document.body);
ele.href = url;