DEV Community

Cover image for Download Images using JavaScript 📸

Download Images using JavaScript 📸

Sapan Bodiwala on March 03, 2021

Let's say you're trying to add a feature to your site or app to allow users to download an image upon clicking a button. Should be pretty straight ...
Collapse
 
vishwakarmad1999 profile image
Divya Vishwakarma

Mota bhai this doesn't work when there's CORS restriction!!!
It will fail at the first fetch call itself.

Collapse
 
semleel profile image
Yi Sem

it works!! thanks alot

Collapse
 
san profile image
Ihsan

Thanks dude!

Collapse
 
akashkaintura profile image
AKASH KAINTURA

Not Helpful

Collapse
 
amirjafari1992 profile image
Amir Jafari

You made my day man! Thank you for sharing

Collapse
 
woochul profile image
Woochul Lee

It works well. Thanks.

Collapse
 
javicodev11 profile image
Javico11

Maybe someone solved the CORS problem?

Collapse
 
uzair004 profile image
Muhammad Uzair

What if image can't be fetched from its source ? it there any other way to get image from DOM ?

Collapse
 
daddasoft profile image
Dadda Hicham

best one thanks 👍

Collapse
 
techemmy profile image
Emmanuel Temitope

Thanks for the solution!

Collapse
 
faisalamin001 profile image
Faisal Amin

Awesome, it worked! 👏

Collapse
 
jefraroce profile image
Jeisson Rosas

Thanks!

Collapse
 
anilserver86 profile image
anil sharma

bro this code is not work in my laptop it is open my image not download

Collapse
 
devslayertech profile image
Dev Slayer.Tech

Poo performance when using base64 > 1MB in src