Reputation: 1194
I have a button in a div with a link to a video. I'd like to have the prompt popup to download the video. I have this code now but it opens a video:
<div class="btn btn-primary-rect " style="text-align: center;" onClick=window.open("<?php echo $lien;?>")>DOWNLOAD THE VIDEO <img src="images/upload.png" class="upload"> </div>
How can I do it properly because I need it working in IE and Firefox, Chrome, Safari...
Upvotes: 0
Views: 219
Reputation: 1650
If you're actually coding this in PHP (as suggested in the tags), then you can use a PHP script to stage the file, and then alter the disposition header to tell the browser to treat the file as an attachment for download, something along the lines of:
header('Content-Disposition: attachment; filename="file-to-download.ext"');
readfile('actual-path-to-file.ext');
Doing it this way, rather than linking directly, will allow you control over how the file is handled on the client side.
Upvotes: 1