0

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.

2 Answers2

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