setting is the following: I have a homepage where I display a diagram that has been constructed using comma seperated values from within the page. I\'d like to give users th
If your users have up to date browsers, the new Blob object could help you.
Based on the example here https://developer.mozilla.org/en/docs/DOM/Blob ("Blob constructor example usage"), you could do something like the following:
var typedArray = "123,abc,456"; //your csv as a string
var blob = new Blob([typedArray], {type: "text/csv"});
var url = URL.createObjectURL(blob);
var a = document.querySelector("#linktocsv"); // the id of the element where you will render the download link
a.href = url;
a.download = "file.csv";