jquery - JavaScript exporting JSP div data to excel file -
i have java script code exporting div data excel file :
$(".excelicon").click(function(e) { //getting values of current time generating file name var timestamp = new date().gettime(); //creating temporary html link element (they support setting file names) var = document.createelement('a'); var data_type = 'data:application/vnd.ms-excel'; //getting data our div contains html table var htmlimg = $('<div>').append($('.div1').clone()).html(); var html = htmlimg.replace(/<img[^>]*>/g,""); var table_html = html.replace(/ /g, '%20'); a.href = data_type + ', ' + table_html; //setting file name a.download = 'file' + '_' + timestamp + '.xls'; //triggering function a.click(); //just in case, prevent default behaviour e.preventdefault(); });
i have used type application/vnd.ms-excel microsoft standard exporting jsp data excel , problem code running in chrome , means able export jsp data excel in chrome not working in ie, safari , firefox (i unable download excel above code in these 3 browser). can guide me lacking these browsers. in advance.
Comments
Post a Comment