0
현재 아래의 자바 스크립트에서 내보내기 데이터를 생성하려고합니다.window.btoa()가 IE에서 작동하지 않습니다.
return window.btoa(unescape(encodeURIComponent(s)))
가 어떻게 IE에서이 문제를 해결하는 방법 말해 주시겠습니까 : 라인에서
"object doesn't support this property or method"
: IE8에서이 코드를 테스트 할 때 , 나는 다음과 같은 오류가? 그것은 다른 브라우저에서 작동합니다. 고맙습니다.
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64 = function (s) {
return window.btoa(unescape(encodeURIComponent(s)))
},
format = function (s, c) {
return s.replace(/{(\w+)}/g, function (m, p) {
return c[p];
})
}
return function (table, name) {
if (!table.nodeType) table = document.getElementById('file')
var ctx = {
worksheet: name || 'Worksheet',
table: table.innerHTML
}
window.location.href = uri + base64(format(template, ctx))
}
})()
어떤 IE 버전입니까? 정확한 오류 메시지 란 무엇입니까? – Christoph
IE 버전 8. 오류 "개체가이 속성 또는 메서드를 지원하지 않습니다." 줄 반환 window.btoa (unescape (encodeURIComponent (s))) –
window.btoa는 IE10에서 지원됩니다. – Christoph