How can I create download link in HTML?

Venkat picture Venkat · May 8, 2010 · Viewed 653.2k times · Source

I have a basic idea of HTML. I want to create the download link in my sample website, but I don't have idea of how to create it. How do I make a link to download a file rather than visit it?

Answer

Felix G. picture Felix G. · May 1, 2013

In modern browsers that support HTML5, the following is possible:

<a href="link/to/your/download/file" download>Download link</a>

You also can use this:

<a href="link/to/your/download/file" download="filename">Download link</a>

This will allow you to change the name of the file actually being downloaded.