Fix download CSV for IE11 which doesn't support the download attribute. Fixes #4040

This commit is contained in:
Murtuza Zabuawala 2019-03-01 13:32:40 +00:00 committed by Dave Page
parent c6d295727c
commit fb747b8031

View File

@ -3597,11 +3597,17 @@ define('tools.querytool', [
.done(function(response) { .done(function(response) {
let urlCreator = window.URL || window.webkitURL, let urlCreator = window.URL || window.webkitURL,
url = urlCreator.createObjectURL(response), url = urlCreator.createObjectURL(response),
link = document.createElement('a'); link = document.createElement('a'),
current_browser = pgAdmin.Browser.get_browser();
link.setAttribute('href', url); if (current_browser.name === 'IE' && window.navigator.msSaveBlob) {
link.setAttribute('download', filename); // IE10+ : (has Blob, but not a[download] or URL)
link.click(); window.navigator.msSaveBlob(response, filename);
} else {
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.click();
}
self.download_csv_obj = undefined; self.download_csv_obj = undefined;
// Enable the execute button // Enable the execute button