I'm working with API and I retrieve all data along with image by sending API request. Now i want to create image download link. In that case if image location is like https://images.unsplash.com/photos/291762/unsplash-photo-291762.jpeg
So, How can i create image download link.
I also try using html Download attribute but it doesn't work it directly opens full images in tab.
Asked
Active
Viewed 226 times
0

Talentrabb World
- 1
- 1
-
Zip the image ,the give the link to the zip file – Code Demon Jun 20 '20 at 08:30
-
Try download attribute like this `download="unsplash.jpeg"`. – isAif Jun 20 '20 at 16:15
2 Answers
0
Weird... I use Chromium-based Edge, and the plain download
attribute works properly. The same goes for Firefox (mobile and desktop).
<a href="https://images.unsplash.com/photos/291762/unsplash-photo-291762.jpeg" download>
Some content/image here
</a>
Or, you can take a look at this answer
. It will require opening in a new tab on click though.

Andreas
- 25
- 3
0
This simple soultion will work. Add ?force=true
at the end of each url href attribute:
<a href="https://images.unsplash.com/unsplash-photo-291762.jpeg?force=true">Download</a>

Frostbourn
- 330
- 3
- 21