This article describes the JavaScript implementation of the client-compatible browser to create a CSV and download the method. Share to everyone for your reference. The implementation methods are as follows:
$ ("#radarDLBut"). Click (function () {
var data = [displaydata["Radar_chart"] ["R_label"],displaydata[Radar_chart "] [" R_default "]];
var csvcontent = "Data:text/csv;charset=utf-8,\ufeff";
if (Window.navigator.msSaveOrOpenBlob) {
csvcontent = "\ufeff";
}
Data.foreach (function (Infoarray, index) {
datastring = Infoarray.join (",");
Csvcontent + = Index < data.length? datastring+ "\ n": datastring;
});
if (Window.navigator.msSaveOrOpenBlob) {
//If browser is IE
var blob = new Blob ([decodeURIComponent encodeURI (csvcontent))],{
type: "Text/csv;charset=utf-8;"
});
Navigator.mssaveblob (Blob, ' subject.csv ');
} else{
var Encodeduri = encodeURI (csvcontent);
var link = document.createelement ("a");
Link.setattribute ("href", Encodeduri);
Link.setattribute ("Download", "Subject.csv");
Document.body.appendChild (link);
Link.click ();
}
);
The
wants this article to help you with your JavaScript programming.