开发者

How do I tell the browser to open an avi file with VLC or similar in HTML?

So I have a list of avi files on a web page (For my own purposes!), and was wo开发者_如何学编程ndering what do I have to put into the html code to tell the browser to open VLC? or mplayer or simliar?


You should make sure that your web server is serving up the avi files with the appropriate Content-Type HTTP header.

Content-Type: video/x-msvideo

-- mime type reference.

This will cause the client's default player associated with the given Content-Type to load with the player. The client's default player will differ from user to user depending on their OS, installed programs and file association settings. For most windows users, this will be Media Player (unless the user has customized the default setting). For Mac users it will be something else (eg. VLC if they've installed it, or maybe Quicktime, if they've installed Flip4Mac). If the client doesn't have support for the given mime type, the browser will treat it as a file download.


The mapping of "helper applications" which deal with specific file/content types is defined at the level of the client (web browsers and such), not within the html sent by the server.

The server-side should of course use the appropriate Content-type and MIME type, in the http header, but the choice of the application or plug-in eventually receiving the stream is defined on the client side.


You can't. Given you send the correct Mime type (see Asaph's comment), you can only hope the browser on the other side is configured to handle these with a video player - it could as well be set just to save them, however.

And that's a good thing. Last thing I would want was self-opening AVI ads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜