how to do auto download when you click on a link code example
Example: how to do auto download when you click on a link
<a href="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" download>download file</a>
var a = document.createElement('a');
a.href = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
a.download = 'download';
a.click();