html: is there a way to tell a browser what application to use for a video?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
html: is there a way to tell a browser what application to use for a video?
At my office, we have mplayer-plugin handling all our video files through the web browser.
The short question is: can I tell the browser which application to use (or to try) before it uses the preference setting?
The slightly longer question is: when someone clicks a direct link to an mp4, I want a particular application to launch it rather than mplayer-plugin. I know I can do this by editing the Iceweasel (firefox) prefs, but can I do it without altering the prefs, i.e. directly in the html/javascript?
To be clear, I'm not looking for another application to handle embedded objects, I'm looking for something to handle direct links to files, i.e.
< a href = 'foo.mp4' > link < /a > (this is what I'm asking about)
as opposed to
< embed src='foo.mp4' width='$x' height='$y'></embed> (this, I don't care as much about, but if it solves the problem, I'll take it).
I'm also not opposed to use object tags if that will do it.
I certainly can't think of any way to do it through HTML. HTML is only bringing the content to the client, it doesn't actually play it. It is up to the configuration in the browser to know what programs to associate with what file extensions.
I certainly can't think of any way to do it through HTML. HTML is only bringing the content to the client, it doesn't actually play it. It is up to the configuration in the browser to know what programs to associate with what file extensions.
hmm... I figured as much.
In the mean time, I'm using this method of forcing a download - essentially just loading up a header that the browser treats as a download. It's a modified version of something I found on the web. This way, someone can chose the application to view the thing because they have the "Open With.." option.
PHP Code:
<?php
$filename = $_GET['file'];
// required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off');
// addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1));
I think you can configure the server to identify the file as something to download. According to this page putting
Code:
AddType application/octet-stream .mp4
in the .htaccess file should work (if you're using Apache that is). I wouldn't expect to able to choose which application, since that would pretty much allow any website to run arbitrary code on your computer...
I think you can configure the server to identify the file as something to download. According to this page putting
Code:
AddType application/octet-stream .mp4
in the .htaccess file should work (if you're using Apache that is). I wouldn't expect to able to choose which application, since that would pretty much allow any website to run arbitrary code on your computer...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.