Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 19
    doesn't work as a trigger, just redirect to the url as 'a' tag. Commented Apr 5, 2016 at 15:02
  • 19
    This works better : <a href="path_to_file" download="proposed_file_name">Download</a> Commented Jul 7, 2016 at 3:33
  • 15
    @kscius even today the download attribute is not supported in IE 11 (it is now supported in Edge) and it is not supported in Safari. In 2012 when the answer was originally posted it wasn't supported in any major browser. Commented Jul 7, 2016 at 3:40
  • 3
    what's the difference between having an anchor with button styling and having a form with a button? Commented Feb 23, 2017 at 9:52
  • 11
    This doesn't necessarily trigger a download. It simply causes the browser to navigate to file.doc. Whether that results in file.doc being downloaded or being shown as a page in the browser depends upon the headers returned by the server when it serves file.doc and on what file types the browser is capable of rendering. Commented Apr 5, 2021 at 19:25