Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open html link to local file in its default program, NOT browser?

Basically, I'm creating a webpage filled with images of movie posters that link to video files, as a means of making a more visually-appealing form of my local video library.

I'm using

<a href="C:\blah\movie.mkv"><img src="poster.jpg">

It works exactly how I want, HOWEVER, it opens the file in the browser rather than opening it in its default program, as I would like. I would like each link to open the file in the program titled "VLC Media Player", as specified in Windows for each of their filetypes.

Let me know how I can do this (in the simplest form--I'm not too smart :P)

Thanks!

like image 830
Bobazonski Avatar asked Sep 18 '25 01:09

Bobazonski


2 Answers

If you are creating web pages on your local system for you own use then you may want to consider looking in to a WAMP server setup. This uses php and should allow you to call VLC using the exec command. Would take some learning however.

like image 66
rich_wills Avatar answered Sep 19 '25 17:09

rich_wills


There is very little you can do to control how a client will handle a resource.

You can use the Content-Disposition HTTP response header to state that the resource is an attachment (and thus recommend that it be downloaded instead of opened).

Content-Disposition: attachment;filename="movie.mkv"

You can't, however, stop browser native support or a plug-in from handling something instead of having it open in a separate application (let alone cause it to be opened in a specific application).

If the browser is configured to open video files internally, then nothing the author of a website can do will make it switch to using a application instead.

like image 34
Quentin Avatar answered Sep 19 '25 17:09

Quentin