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?



You can try the html5 download attribute.

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


In addition to Musa's answer:

Try setting the Content-Disposition header. You will need to set this up either in your server configuration, or let a executable script on your server do this (such as php):

Content-Disposition: attachment; filename="mymovie.mov"


if you're using a server side page to serve up content, by chance, then you can easily set the header of that page Content-Disposition: attachment and/or Content-Type:binary so that it kicks off a download.

otherwise, you can use download attribute in your <a> tag, which will only work in some browsers.

lastly, if you're feeling really heroic, you can go hack on your mime-types settings config file in your web server, in which you'd set the content disposition there.


  • angularjs ng-bind-html html input part missing
  • Rails 4.0.0 jQuery Mobile button icons not showing in production
  • Simple test app deploys to Heroku but won't run
  • How to check if DIV element is disabled using jquery
  • Yii2: Using Kartik Depdrop Widget?
  • Zend Framework + Doctrine1.2 project structure with more modules
  • CoreData basics – to-many relationship array data
  • Client side validation mvc dropdown
  • Should a web service response include empty values?
  • File extension of zlib zipped html page?
  • Pass array from parent template to child template
  • Jquery Mobile pageLoading() Method how does it work?
  • Optimizing the print function in Matlab
  • Combining two different ActiveRecord collections into one
  • Angularjs pass function from Controller to Directive (or call controller function from directive) -
  • Simulate click Geckofx vb,net
  • Automatically associate new Sonar project with custom quality profile and quality gate
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • jQuery ready not fired after rails link_to is clicked
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Jquery UI tool tip close icon
  • Xamarin Forms - UWP Fonts
  • Updating server-side rendering client-side
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How to set the response of a form post action to a iframe source?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • EntityFramework adding new object to nested object collection
  • sending mail using smtp is too slow
  • Checking variable from a different class in C#
  • Busy indicator not showing up in wpf window [duplicate]
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • How can I use `wmic` in a Windows PE script?
  • failed to connect to specific WiFi in android programmatically
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • How can I use threading to 'tick' a timer to be accessed by other threads?