Javascript/ jQuery : Exporting data in CSV not working in IE

后端 未结 6 1453
太阳男子
太阳男子 2020-12-25 13:43

I need to Export Data displayed in a Table to CSV Format. I have tried lot many things but couldn\'t get it working for IE 9 and above.

I have created a dummy fiddle

6条回答
  •  天涯浪人
    2020-12-25 14:15

    I got the solution for it which is supporting IE 8+ for me. We need to specify the separator as shown below.

    if (navigator.appName == "Microsoft Internet Explorer") {    
        var oWin = window.open();
        oWin.document.write('sep=,\r\n' + CSV);
        oWin.document.close();
        oWin.document.execCommand('SaveAs', true, fileName + ".csv");
        oWin.close();
      }  
    

    You can go through the link http://andrew-b.com/view/article/44

提交回复
热议问题