DEV Community

Downloading images in the browser with Node.js

Eckhardt on September 09, 2021

Image downloading in modern browsers seems like a topic trivial enough - why write about it? The drawback of native HTML downloading HT...
Collapse
 
charlesr1971 profile image
Charles Robertson

This is great, but why are you adding the link using JavaScript. The problem with this approach, is that if someone keeps clicking on the download button, many invisible links get added to the DOM.
I have just added an HTML link with the download attribute. And added the relevant href to my image file. Then when a user clicks on the link, the Save dialog box appears. This is much nicer, than asking users to right click on an image and press Save.