Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ie9 specific code #1600

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 8 additions & 35 deletions src/15utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,48 +781,21 @@ var saveFile = (utils.saveFile = function (path, data, cb, opts) {
// });
// });
} else {
if (isIE() === 9) {
// Solution was taken from
// http://megatuto.com/formation-JAVASCRIPT.php?JAVASCRIPT_Example=Javascript+Save+CSV+file+in+IE+8/IE+9+without+using+window.open()+Categorie+javascript+internet-explorer-8&category=&article=7993
// var URI = 'data:text/plain;charset=utf-8,';

// Prepare data
var ndata = data.replace(/\r\n/g, '&#A;&#D;');
ndata = ndata.replace(/\n/g, '&#D;');
ndata = ndata.replace(/\t/g, '	');
var testlink = utils.global.open('about:blank', '_blank');
testlink.document.write(ndata); //fileData has contents for the file
testlink.document.close();
testlink.document.execCommand('SaveAs', false, path);
testlink.close();
} else {
var opt = {
disableAutoBom: false,
};
alasql.utils.extend(opt, opts);
var blob = new Blob([data], {type: 'text/plain;charset=utf-8'});
saveAs(blob, path, opt.disableAutoBom);
if (cb) {
res = cb(res);
}
var opt = {
disableAutoBom: false,
};
alasql.utils.extend(opt, opts);
var blob = new Blob([data], {type: 'text/plain;charset=utf-8'});
saveAs(blob, path, opt.disableAutoBom);
if (cb) {
res = cb(res);
}
}
}

return res;
});

/**
@function Is this IE9
@return {boolean} True for IE9 and false for other browsers

For IE9 compatibility issues
*/
function isIE() {
var myNav = navigator.userAgent.toLowerCase();
return myNav.indexOf('msie') !== -1 ? parseInt(myNav.split('msie')[1]) : false;
}

// For LOAD
// var saveBinaryFile = utils.saveFile = function(path, data, cb) {
// if(utils.isNode) {
Expand Down
24 changes: 1 addition & 23 deletions src/833xlsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,29 +188,7 @@ alasql.into.XLSX = function (filename, opts, data, columns, cb) {
// saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), '"'+filename+'"')
// saveAs(new Blob([s2ab(wbout)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}), filename)
// saveAs(new Blob([s2ab(wbout)],{type:"application/vnd.ms-excel"}), '"'+filename+'"');
if (isIE() == 9) {
throw new Error('Cannot save XLSX files in IE9. Please use XLS() export function');
// var URI = 'data:text/plain;charset=utf-8,';

/** @todo Check if this code is required */

/*/*
var testlink = window.open("about:blank", "_blank");
var s = '';
for(var i=0,ilen=wbout.length;i<ilen;i++) {
var ch = wbout.charCodeAt(i);
if(i<20) console.log('&#'+ch+';');
s += '&#x'+ch.toString(16)+';';
};
testlink.document.write(s); //fileData has contents for the file
testlink.document.close();
testlink.document.execCommand('SaveAs', false, filename);
testlink.close();
*/
// alert('ie9');
} else {
saveAs(new Blob([s2ab(wbout)], {type: 'application/octet-stream'}), filename);
}
saveAs(new Blob([s2ab(wbout)], {type: 'application/octet-stream'}), filename);
}
}
/*/*
Expand Down