tableExport.js在ie浏览器中失效。

在tableExport.js中报 The data area passed to a system call is too small
经分析是base64转换的时候出现这个错误。

ie不支持data:协议吧。。

如果是ie你需要自己提交到服务器,然后设置content-type和content-disposition为attachment后输出内容来实现保存文件

IE用表单来提交试试。。注意修改action的地址。

Content-Disposition inline attachment


        if (!!window.ActiveXObject || "ActiveXObject" in window) {//IE浏览器
            //用form表单来提交
            var f = document.createElement('form'); f.method = 'post'; f.action = 'xxxxxxx';
            var ipt = document.createElement('input'); ipt.type = 'hidden'; ipt.value = excelFile; f.appendChild(ipt);
            f.submit();
        }
        else {

            var excelFileUtf8 = $.base64.utf8(excelFile);
            var base64data = "base64," + $.base64.encode(excelFileUtf8);
            $('<a style="display:none" href="data:application/vnd.ms-' + defaults.type + ';filename=exportData.doc;' + base64data + '" download="' + defaults.tableName.toString() + '.xls"><span></span></a>').appendTo(document.body).find('span').trigger("click").parent().remove();
        }