How to create direct link to download a video

Asked

Viewed 5,093 times

2

Good guys, I tried to create a direct link to download a video, but as many probably already know this doesn’t work very well. In fact the only thing that happens when I click on the link is that it opens a new tab and the video runs directly in the browser. If I zip the file the download works, but I do not want it, as I said in the question title what I am looking for is a way to force the download of the video and not the playback of the same.

About the code I used in the link to my failed attempt to create the download has no secret, it was simple html.

<a href="video.mp4">DOWNLOAD</a>
  • You have access to the server-side code?

  • 1

    Forgive me for my ignorance, but I don’t know what that means.

  • 1

    If you are using HTML5, you could try using the attribute download, without having to touch the server. Have a look at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

  • 1

    @ivanveloso, take a look here: http://answall.com/q/608/129

  • Walkin and Sergio, thanks for the information, I got.

1 answer

3


Use the attribute download.

<a download href="video.mp4">DOWNLOAD</a>

You can use the attribute to define the name the file should be saved to:

<a download="Férias da Família 2013.mp4" href="video.mp4">DOWNLOAD</a>

Only works with current browsers with HTML5 support.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.