Search code examples
javascripthtmldownloadmove

HTML download movie download link


I want a user to be able to hit a button which triggers a .mov file to download. Linking to the file its self just causes the movie to play in a new page.

I have tried this:

<a onclick="document.execCommand('SaveAs',true,'assets/files/mymovie.mov');" href="javascript:void(0);">

But this does not seem to work.

Can anyone point me in the right direction?

Thanks


Solution

  • You can try the html5 download attribute.

    <a href='assets/files/mymovie.mov' download>