Reputation: 21
Hi I have an anchor tag with download attribute which when clicked downloads the image from the url defined in href. This works fine in Chrome but in Firefox it takes to the image in the browser. Is there any way we can make this work in FF
<a href="https://www.ricoh.com/r_dc/r/r8/img/sample_10.jpg" download="JPG">image</a>
Upvotes: 2
Views: 640
Reputation: 5713
The problem with this is that in Firefox this only works for files with the same origin. From MDN:
In Firefox 20 this attribute is only honored for links to resources with the same-origin.
I see three solutions:
Content-Type: application/octet-stream
header which will force the browser to download the image regardless of how the download link looksUpvotes: 4