Then you can use JavaScript’s window.open and encodeURI functions to download the CSV file like so:

var encodedUri = encodeURI(csvContent);
window.open(encodedUri);

Edit:

If you want to give your file a specific name, you have to do things a little differently since this is not supported accessing a data URI using the window.open method. In order to achieve this, you can create a hidden <a> DOM node and set its download attribute as follows:

Related Posts

Question: ❓❓❓ I have been reading through the C++ FAQ and was curious about the friend declaration. I personally have never used it, however I am interested in exploring the language. What is a good Read more…

Question: ❓❓❓ I observed that rand() library function when it is called just once within a loop, it almost always produces positive numbers. for (i = 0; i < 100; i++) { printf("%d\n", rand()); } Read more…

Question: ❓❓❓ Consider the main axis and cross axis of a flex container: Source: W3C To align flex items along the main axis there is one property: justify-content To align flex items along the cross Read more…