I used below code for that but its works only in Firefox. It also not allow customize exported file name. It takes a random file name.
var tableToExcel = (f
The Firefox supports the HTML 5 feature data-uri here data:application
HTML 5
data-uri
data:application
If you want to make it work across all browsers, better do it in server side and set the response ContentTypeaccordingly.
ContentType