I'm editing some codes that control a database website using PHP, Javascript, and MySQL, and I'd like to add a button function that would allow me to export my data into an Excel file. Currently, the function below works for Firefox only--how do I create a function that would be compatible with Internet Explorer? I know that in IE8 I can simply right click and select "Export to Microsoft Excel", but for some reason in IE7, there is no option to do that, which is why I'm making this button.
Function for Firefox:
function write_to_excel(tableid) {
var table=document.getElementById(tableid);
var html=table.outerHTML;
window.open('data:application/vnd.ms-excel.' + encodeURIComponent(html);
}
Thanks in advance!