Thursday, 15 September 2011

javascript - window.btoa() not working in IE -



javascript - window.btoa() not working in IE -

i'm trying create export info excel javascript below. when testing code in ie8, next error:

"object doesn't back upwards property or method"

at line:

return window.btoa(unescape(encodeuricomponent(s)))

can please tell me how prepare in ie? it's working in other browsers. give thanks much.

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) { homecoming window.btoa(unescape(encodeuricomponent(s))) }, format = function (s, c) { homecoming s.replace(/{(\w+)}/g, function (m, p) { homecoming c[p]; }) } homecoming 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)) } })()

ie8 not back upwards window.btoa.

there polyfills out there back upwards older browsers.

javascript

No comments:

Post a Comment