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) {
let urlCreator = window.URL || window.webkitURL,
url = urlCreator.createObjectURL(response),
link = document.createElement('a');
link = document.createElement('a'),
current_browser = pgAdmin.Browser.get_browser();
if (current_browser.name === 'IE' && window.navigator.msSaveBlob) {
// IE10+ : (has Blob, but not a[download] or URL)
window.navigator.msSaveBlob(response, filename);
} else {
link.setAttribute('href', url);
link.setAttribute('download', filename);
link.click();
}
self.download_csv_obj = undefined;
// Enable the execute button