How to export a HTML table to Excel supported by Chrome and IE?

On my MVC project I have a HTML table bound with Knockout. I’m trying to Export the table to Excel. I tried on client side with JavaScript: OR: But both codes work in Chrome but not in IE. I would like to do it on client side using JavaScript or jQuery but if there is not a solution that is supported by both browsers I can also do it in server side with an AJAX Post Request to my Web API. How can I export a HTML table to Excel supported by Chrome and IE using JavaScript/jQuery OR AJAX and