0

I am trying to get my file, which is in my image folder, to become downloadable. I have simply linked it in my site as

 <a href="images/Resume.jpg" download> Resume</a>

I have edited it to this, but is still not working in Internet Explorer, therefore can I have another option available for internet explorer as well.

It's a simple jpeg. When clicked, it opens the page and the picture appears. But I want it to be downloaded the moment it's clicked. Not open in another page to be right clicked saved. Can I do this with java script as the download attribute isn't supported in internet explorer. Current Knowledge - HMTL5/CSS/ Some JavaScript.

Bryan
  • 1
  • 3
  • The answer highly depends on which webserver (e.g. Apache, IIS, ...) you are using. You need to send the correct http headers there. Alternatively you can work around this by using any scripting language which sends correct headers for download (`Content-Disposition: attachment; filename="Resume.jpg" `) and then reads and outputs the image raw data. – udondan Mar 17 '15 at 02:21
  • Well. I don't know much about any other languages. I know HTML & CSS. Explain. – Bryan Mar 17 '15 at 02:24

3 Answers3

0

It should look like this:

<a href="images/Resume.jpg" download="Resume.doc">Resume</a>

You are missing the location. Unless the name of the file you are trying to download is just "Resume" and is in the same location as the page this is being displayed.

FYI, this is a HTML5 feature and is not supported by IE and Safari.

Source: W3Schools

Michael
  • 316
  • 3
  • 18
0

First off, you would only need download, not download='...'. This, however isn't supported by all browsers, see Force a browser to save file as after clicking link. I don't believe that you can accomplish what you want in pure HTML if your current html5 magic isn't working for you. This link may work for you if you go the .htaccess way - https://css-tricks.com/snippets/htaccess/force-files-to-download-not-open-in-browser/.

Community
  • 1
  • 1
Maxwell S
  • 135
  • 9
0

As far as I understand the download attribute, you shouldn't need to give a descriptor. So

<a href="images/Resume.jpg" download>Resume</a>

ought to work.

According to w3schools (as of 3/16/15), download isn't supported across all browsers, though, which might be leading to your problem (and a potential problem for folks looking to save your resume in a single click). Right now, it looks like Chrome and Firefox support it, but not IE or Safari.

Matt Frye
  • 13
  • 4