Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 导出文件在IE 11中不起作用_Excel_Internet Explorer_Export - Fatal编程技术网

Excel 导出文件在IE 11中不起作用

Excel 导出文件在IE 11中不起作用,excel,internet-explorer,export,Excel,Internet Explorer,Export,我正在尝试导出一个Excel文件,到目前为止,它确实适用于除IE 11之外的浏览器。以下是我的代码: if (navigator.appName == "Microsoft Internet Explorer") { myFrame.document.open("text/html", "replace"); myFrame.document.write(data); myFrame.document.close(); myFra

我正在尝试导出一个Excel文件,到目前为止,它确实适用于除IE 11之外的浏览器。以下是我的代码:

if (navigator.appName == "Microsoft Internet Explorer") {

        myFrame.document.open("text/html", "replace");
        myFrame.document.write(data);
        myFrame.document.close();
        myFrame.focus();
        myFrame.document.execCommand('SaveAs', true, fileName);
    } else {
        var blobdata = new Blob(data], { type: 'data:application/vnd.ms-excel' });
        var link = document.createElement("a");
        link.setAttribute("href", window.URL.createObjectURL(blobdata));
        link.setAttribute("download", fileName);
        document.body.appendChild(link);
        link.click();
    }
IE 11中没有错误消息,只是什么也没发生。它适用于IE<11


谢谢,

我认为navigator.appname不是您想要的, 发件人: 返回的值因浏览器而异: IE11、Firefox、Chrome和Safari返回“Netscape” IE 10和早期版本返回“Microsoft Internet Explorer” 歌剧回归“歌剧”

您可以考虑使用Navigal.UsAgent


并确保正确解析字符串。

谢谢,我这样做太粗心了