Remove msSaveBlob fallback for IE

This commit is contained in:
Maximilian Krög
2022-07-30 22:58:47 +02:00
parent e56bda5848
commit e0fd784c16
4 changed files with 12 additions and 32 deletions
+3 -8
View File
@@ -139,14 +139,9 @@ function download(fullpath, filename) {
return response.blob(); return response.blob();
}) })
.then(function (blob) { .then(function (blob) {
if (navigator.msSaveBlob) { link.href = URL.createObjectURL(blob);
// link download attribute does not work on MS browsers link.download = filename;
navigator.msSaveBlob(blob, filename); link.click();
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
}); });
} }
+3 -8
View File
@@ -107,14 +107,9 @@ function download(fullpath, filename) {
return response.blob(); return response.blob();
}) })
.then(function (blob) { .then(function (blob) {
if (navigator.msSaveBlob) { link.href = URL.createObjectURL(blob);
// link download attribute does not work on MS browsers link.download = filename;
navigator.msSaveBlob(blob, filename); link.click();
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
}); });
} }
+3 -8
View File
@@ -101,14 +101,9 @@ function download(fullpath, filename) {
return response.blob(); return response.blob();
}) })
.then(function (blob) { .then(function (blob) {
if (navigator.msSaveBlob) { link.href = URL.createObjectURL(blob);
// link download attribute does not work on MS browsers link.download = filename;
navigator.msSaveBlob(blob, filename); link.click();
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
}); });
} }
+3 -8
View File
@@ -99,14 +99,9 @@ document.getElementById('export-png').addEventListener('click', function () {
} }
); );
mapContext.globalAlpha = 1; mapContext.globalAlpha = 1;
if (navigator.msSaveBlob) { const link = document.getElementById('image-download');
// link download attribute does not work on MS browsers link.href = mapCanvas.toDataURL();
navigator.msSaveBlob(mapCanvas.msToBlob(), 'map.png'); link.click();
} else {
const link = document.getElementById('image-download');
link.href = mapCanvas.toDataURL();
link.click();
}
}); });
map.renderSync(); map.renderSync();
}); });