I'm using the jQuery Table to CSV Plugin. I've altered the popup so that it tells the browser to download a CSV file.
It was:
function popup(data) {
var generator = window.open('', 'csv', 'height=400,width=600');
generator.document.write('
CSV');generator.document.write('
');generator.document.write('');
generator.document.write(data);
generator.document.write('');
generator.document.write('');
generator.document.close();
return true;
}
I've changed it to:
function popup(data) {
window.location='data:text/csv;charset=utf8,' + encodeURIComponent(data);
return true;
}
It works, for the most part. It still requires that you find your spreadsheet software, and create your own filename...because it creates a strange file name (Example: 14YuskG_.csv.part).
Any suggestions on how to improve this?