I'm creating a custom theme for WP and it has some pages that play videos from WP media library with an HTML5 player. I wanted to also have a link next to the player to allow the users to download the videos.

But a direct link to an mp4 file opens a native player in some browsers (like Chrome and Safari) and plays the video instead of opening it. So I'd have to put a note next to the link "Right click and choose save link as..." to let the users know how to save it, and I'd like to avoid that if possible.

So my question is, is there a way to maybe change the mime-type of the video (but only when accessed through the download link) to "application/octet-stream", or some other way, to make the browser save the file by default, instead of downloading it?


use this in your .htaccess file:

ForceType applicaton/octet-stream

and it will force mp4 download from links

edit: force will force download if it's a link, but if you include the mp4 file in an object like an html5 video element, it will be played.

  • I already have AddType video/mp4 mp4 m4v in my .htaccess to make those files play on html5 browsers. Is ForceType compatible with it? I want to be able to play with the player and save with the link at the same time :) – Matt Jan 24 '12 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.