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

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 download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob); link.href = URL.createObjectURL(blob);
link.download = filename; link.download = filename;
link.click(); link.click();
}
}); });
} }

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 download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob); link.href = URL.createObjectURL(blob);
link.download = filename; link.download = filename;
link.click(); link.click();
}
}); });
} }

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 download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob); link.href = URL.createObjectURL(blob);
link.download = filename; link.download = filename;
link.click(); link.click();
}
}); });
} }

View File

@@ -99,14 +99,9 @@ document.getElementById('export-png').addEventListener('click', function () {
} }
); );
mapContext.globalAlpha = 1; mapContext.globalAlpha = 1;
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), 'map.png');
} else {
const link = document.getElementById('image-download'); const link = document.getElementById('image-download');
link.href = mapCanvas.toDataURL(); link.href = mapCanvas.toDataURL();
link.click(); link.click();
}
}); });
map.renderSync(); map.renderSync();
}); });