1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Fix issue with MS Edge not downloading export HTML file

This commit is contained in:
Harvey Kandola 2019-01-20 16:49:32 +00:00
parent e737339090
commit e8735ffc12

View file

@ -55,17 +55,20 @@ export default Service.extend({
downloadFile(content, filename) {
let b = new Blob([content], { type: 'text/html' });
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(b, filename);
} else {
let a = document.createElement("a");
a.style = "display: none;";
document.body.appendChild(a);
let url = window.URL.createObjectURL(b);
let url = window.URL.createObjectURL(b);
a.href = url;
a.download = filename;
a.click();
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
}
});