how to add file type handler to firefox ?

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Thu Sep 15 01:37:35 UTC 2005


On Tue, Sep 13, 2005 at 02:07:30PM +0300, Peter wrote
> 
> Hi all,
> 
> firefox is 'the most configurable browser' etc but I have a great time 
> trying to add a new file type handler to it, or finding information about 
> how to do it. The next step will be to get the source and disassemble it 
> and find out.
> 
> Before I do that, has anyone got a solution for this. The solution should 
> be cross platform. Please do not point me to tutorials on the web, or to 
> hearsay, as I can use (and have used) a search engine myself. Please only 
> answer if you have actually done this (added a NEW protocol handler for a 
> protocol that is not supported by default, BY HAND or BY SCRIPT, i.e. not 
> using a third party application).

  There are 2 ways of doing it, which are basically identical.  Here's a
real-life example where I wanted mplayer to handle mms and pnm and rtsp
(I've built mplayer to pass the URLs on to RealPlayer if they turn out
to be RealPlayer codecs).

  Method 1) Create a file user.js (if it doesn't already exist) in the
same user directory where prefs.js sits.  Add these lines...

user_pref("network.protocol-handler.expose.mms", true);
user_pref("network.protocol-handler.expose.pnm", true);
user_pref("network.protocol-handler.expose.rtsp", true);

user_pref("network.protocol-handler.app.mms","/usr/bin/mplayer");
user_pref("network.protocol-handler.app.pnm","/usr/bin/mplayer");
user_pref("network.protocol-handler.app.rtsp","/usr/bin/mplayer");

  Make sure that you close your browser first, and restart it after
editing user.js.

  Optional stuff...
  You can get rid of the individual "expose" lines if you use...
user_pref("network.protocol-handler.expose-all", true);

  If you want, you can add a warning for external handlers, if you
don't trust websites.  If set to true, this'll bring up a warning dialog
each time you launch the corresponding protocol...

user_pref("network.protocol-handler.warn-external.mms", false);
user_pref("network.protocol-handler.warn-external.pnm", false);
user_pref("network.protocol-handler.warn-external.rtsp", false);


  Method 2) From the web interface; clunkier if you want to do several
machines.  Open your browser to "about:config".  Look for the lines
beginning with "network.protocol-handler".  You can change values, and
you can create new lines using similar syntax.

-- 
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
My musings on technology and security at http://tech_sec.blog.ca
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list