0

I currently have the following html:

<p>Your download will begin shortly. If it doesn't,
      <a id="downloadlink" href="Downloads\Run_Hide_Fight.mp4">click here</a>. 
</p>

In my javascript, I have the following:

<script type="text/javascript">
    window.onclick= function() {
        window.location= document.getElementById('downloadlink').href;
    }
</script>

However, in IE8 and above, instead downloading the file, the file that is open directly to my media player. I would like it the file to be downloaded but not open up automatically based on the users default media player.

Robert
  • 167
  • 1
  • 2
  • 14

1 Answers1

1

You can't control what mime types a client is capable of opening and the download HTML5 attribute doesn't work in any version of IE.

What you'll have to do is change the file extension to something that doesn't open automatically in any client and, rather than just renaming the file and then telling users that they have to rename it back after downloading, and given that you are talking about potentially large files, just zipping the .mp4 files and offering those as the download type will do it.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71