I am trying to use the download attribute, it works on Firefox but when I run the same HTML file in Chrome it does not work.

This is my html file:

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">

      <a download="mylogo" href="san-francisco.jpg"><img src="san-francisco.jpg" alt="Photo" width="104" height="142"></a>


1 Answers

Community On

Try this:

<a target="_blank" download="mylogo" href="san-francisco.jpg" title="ImageName">
    <img alt="ImageName" src="san-francisco.jpg" width="104" height="142">

If it wasn't for this:

download attribute:

If the HTTP header Content-Disposition: is present and gives a different filename than this attribute, the HTTP header has priority over this attribute.

If this attribute is present and Content-Disposition: is set to inline, Firefox gives priority to Content-Disposition, like for the filename case, while Chrome gives priority to the download attribute.


HTTP-Header Content-Disposition