I'am trying to download temporary result calculated by JavaScript. Say I have a string str
, I want to download a file contains str
and named it as data.csv
, I'm using the following code:
window.open('data:text/csv;charset=utf-8,' + str);
The file can be successfully downloaded, but how can I name the file data.csv
automatically rather than set the name by hand each time?