HTML Export to Excel using JavaScript ,WORKING IN FIREFOX but NOT IN IE & CHROME

依然范特西╮ 提交于 2019-12-20 15:36:27

问题


I have a database generated table using PHP .

For exporting the table , I am using the following code to save its contents in .xls format.

Previously this script was working fine in Chrome , but now it has stopped ...when I click the button then a window opens but NO FILE GETS DOWNLOADED.....?

BUT IN FIREFOX it works

What may be the problem in Chrome ? How do I find out that problem , is there any tool to find out the script problem in Chrome?

Please help.

$( "#Export" ).click(function() {  
    var Contents = $('#MyTable').html();    
    alert(''+Contents);
    window.open('data:application/vnd.ms-excel, ' +  '<table>'+encodeURIComponent($('#MyTable').html()) +  '</table>' );
    alert('exporting records...');
});

In Chrome , both the Message boxes are also displayed, but no file gets saved on my PC. It was previously working without any problem but I don't know why it has stopped now.

来源:https://stackoverflow.com/questions/10679927/html-export-to-excel-using-javascript-working-in-firefox-but-not-in-ie-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!