Reputation: 100
I am using this common method to download a file in javascript:
var URI = //some uri
var dl = document.createElement('a');
dl.href = URI;
dl.download = 'file name';
document.body.appendChild(dl);
download_link.click();
document.body.removeChild(dl);
When I execute it the first time it works, but fails for the next downloads. Do you know why this is? Thanks
Upvotes: 0
Views: 126
Reputation: 89
Trying to run your code for the second time, Chrome shows this message:
My browser is in pt-BR, the translation is as follows:
http://stackoverflow.com would like to:
* Download multiple files
[Allow] [Block]
If you block it, it will not download the next files. You can check your current permission settings by click in the (i) icon before the URL and looking for automatic downloads. The default only downloads once.
Upvotes: 1