Skip to content

Commit

Permalink
Merge pull request jspreadsheet#295 from adamdehaven/internet-explore…
Browse files Browse the repository at this point in the history
…r-11-download-fix

Resolves Internet Explorer download issue(s)
  • Loading branch information
pphod authored Feb 28, 2019
2 parents 68b2cb7 + 6fb7c00 commit 53f8db1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions dist/js/jquery.jexcel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4048,14 +4048,20 @@ var methods = {
data += $(this).jexcel('copy', false, ',', true);

// Download element
var pom = document.createElement('a');
var blob = new Blob(["\uFEFF"+data], {type: 'text/csv;charset=utf-8;'});
var url = URL.createObjectURL(blob);
pom.href = url;
pom.setAttribute('download', options.csvFileName + '.csv');
document.body.appendChild(pom);
pom.click();
document.body.removeChild(pom);

// IE Compatibility
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob, options.csvFileName + '.csv');
} else {
var pom = document.createElement('a');
var url = URL.createObjectURL(blob);
pom.href = url;
pom.setAttribute('download', options.csvFileName + '.csv');
document.body.appendChild(pom);
pom.click();
document.body.removeChild(pom);
}
},

/**
Expand Down

0 comments on commit 53f8db1

Please sign in to comment.