javascript - Export to excel a table with proper file name using jquery in IE and Mozilla both -


i have written code exporting table excel file in jquery. working fine me without proper file name. file name character, digits % sign. here code- function exporttoexcel() {

var contents = $(".pvtrendererarea").html();  var ua = window.navigator.useragent; var msie = ua.indexof("msie "); if (msie > 0 || !!navigator.useragent.match(/trident.*rv\:11\./))      // if internet explorer {      txtarea1.document.open("txt/html", "replace");     txtarea1.document.write(contents);     txtarea1.document.close();     txtarea1.focus();     txtarea1.document.execcommand("saveas", true, "dataanalytics.xls"); } else {      window.open('data:application/vnd.ms-excel,' + encodeuricomponent(contents)); // content id of div element    } 

}

how give proper file name can tell me?

also export excel in ie above code, saving file in html format html content. how write code ie work properly?

here txtarea1 iframe id added in aspx page.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -