问题
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