I am creating a CSV element in JavaScript and then simulating a click to download the respective file.
But instead of downloading directly i want it to open a download prompt to choose the location of file to be downloaded.
var csvString = Papa.unparse(result,{
quotes: false,
delimiter: ",",
newline: "\r\n"
});
var a = document.createElement('a');
a.href = 'data:attachment/csv,' + escape(csvString);
a.download = "download.csv";
a.click();
How can this be done?
This is a browser specific setting.
Settings > Downloads >
and then select checkbox
Ask where to save each file before downloading
Tools > Options
, open General
tab and select radio button Always ask me where to save files
Save
button and choose the location.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With