Re: User made protocols
Ralph Fox <[email protected]> Tue, 22 Nov 2005 10:16:08 +0000
| Newsgroups | gmane.comp.mozilla.devel.windows |
|---|---|
| Organization | No; Y2.038Chaos Instead! |
| Message-ID | <[email protected]> |
On Mon, 21 Nov 2005 21:16:53 +0100, in message <[email protected]>, Kim Ludvigsen wrote: > In the OS/2 version of Firefox it is possible to use Firefox as a tv > interface, where a webpage with pictures can link to and open various > programs on the computer. > > It is done by making user made protocols like the following in prefs.js: > > user_pref("applications.photo", "c:\\programs\\photo.exe"); > user_pref("applications.photo.parameters", "%url%"); > > A link like <a href="photo:">photo</a> will open the program, and <a > href="photo:myphoto.jpg">my photo</a> will open myphoto.jpg in the photo > program. > > Is there any way to make this work in the Windows version of Firefox? Yes. In the Windows version of Firefox, you can set a protocol to (a) either be handled by Firefox; or (b) to be handled by the Windows registry settings for that protocol (i.e. by whatever application Windows has associated with that protocol). So to get what you want, you need to do this 1. in prefs.js user_pref("network.protocol-handler.external.photo",true); 2. in the Windows registry (note the following is in .reg file format) [HKEY_CLASSES_ROOT\photo] @="URL:photo protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\photo\shell] [HKEY_CLASSES_ROOT\photo\shell\open] [HKEY_CLASSES_ROOT\photo\shell\open\command] @="\c:\\programs\\photo.exe\" %1" Note that photo.exe will be passed the entire photo: URL, e.g. photo:myphoto.jpg and not just then part after the "photo:". If this is a problem, you may wish to have the registry launch a script which modifies the command-line parameter before passing it on to photo.exe. Unforch Windows .bat files are utterly feeble for scripting work; you'll want something better. Don't forget the "URL Protocol"="" Without it, this won't be recognized as a URL protocol association. > Or is there any other way to open programs from a (local) webpage? > > Regards > Kim Ludvigsen