반응형
function excelExport(){
exportTable($('#jsGrid').html(), 'myFilename.xls');
}
function exportTable(myTable, filename) {
var agent = navigator.userAgent.toLowerCase();
if ( (navigator.appName == 'Netscape' && agent.indexOf('trident') != -1) || (agent.indexOf("msie") != -1)) {
// ie일 경우
csvData = myTable;
if (window.navigator.msSaveBlob) {
var blob = new Blob([csvData], {
type: "text/html"
});
navigator.msSaveBlob(blob, filename);
}
}else{
// ie가 아닐 경우
window.open("data:application/vnd.ms-excel," + encodeURIComponent(myTable));
}
}