Is there a universal way to export an HTML page to XLS using JavaScript that will work on all three latest versions of browsers? I have found methods for exporting in Internet Explorer, Mozilla and Chrome.
In Internet Explorer:
window.clipboardData.setData("Text", vTable);
var objExcel = new ActiveXObject("Excel.Application");
objExcel.visible = false;
var objWorkbook = objExcel.Workbooks.Add;
var objWorksheet = objWorkbook.Worksheets(1);
objWorksheet.Paste;
objExcel.visible = true;
In Mozilla and Chrome:
var url='data:application/vnd.ms-excel,' + encodeURIComponent($('#divExport').html()) ;
location.href=url;