Fixed downloading of monitor parameters for IE11 and Edge

Related-to: 5389a26b92
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-04-03 22:50:47 +02:00
parent cae7efe039
commit 038c654ec4
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -573,11 +573,19 @@ AJAX.registerOnload('server_status_monitor.js', function () {
};
var blob = new Blob([JSON.stringify(exportData)], { type: 'application/octet-stream' });
var url = window.URL.createObjectURL(blob);
window.location.href = url;
var url = null;
var fileName = 'monitor-config.json';
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob, fileName);
} else {
url = URL.createObjectURL(blob);
window.location.href = url;
}
setTimeout(function () {
// For some browsers it is necessary to delay revoking the ObjectURL
window.URL.revokeObjectURL(url);
if (url !== null) {
window.URL.revokeObjectURL(url);
}
url = undefined;
blob = undefined;
}, 100);