Frequently Asked Questions
UBC Mathematics: MathNet FAQ [Firefox Helper Application]



UBC Mathematics: MathNet FAQ [Firefox Helper Application]




Question: How do I get Firefox to run an external application on a particular file type?
Author: Joseph Tam, Joel Feldman (MimeEdit extension)
Date: Feb. 26, 2008

A helper application is a program external to the browser that will open its own window or terminal to display results. A helper application is not the same ias a plugin. A plugin is loaded by the browser process data internally and render the results within the browser window (e.g. Acrobaty Reader plugin for PDF files).

This FAQ does not cover the installation of plugins; you have to go elsewhere for that.

If you want Firefox to autmatically use an external helper program to process files of a particular type (characterized by a filename extension or MIME type) whenever you click on a link to that file, these are the steps you can perform.

Manual Method

  • Step 1 (optional): backup your existing Firefox MIME database in case you screw it up. You can also delete the file and let Firefox rebuild it if things go wrong.
    	cd ~/.mozilla/firefox/user-profile
    	cp mimeTypes.rdf mimeTypes.rdf~
    	# Now you can edit this file ...
    	vi mimeTypes.rdf 
  • Step 2: add the MIME type to the list of helpers Firefox should handle. If the <RDF:Seq ... </RDF:Seq> tag already exists, only add the middle line.
    	<RDF:Seq RDF:about="urn:mimetypes:root">
    	  ...
    	  <RDF:li RDF:resource="urn:mimetype:application/testapp"/>
    	</RDF:Seq> 
  • Step 3: associate file extensions with this MIME type:
    	<RDF:Description RDF:about="urn:mimetype:application/testapp"
    	  NC:editable="true"
    	  NC:value="application/testapp"
    	  NC:description="Description of MIME type">
    	  <NC:fileExtensions>ext1</NC:fileExtensions>
    	  <NC:fileExtensions>ext2</NC:fileExtensions>
    	  ...
    	  <NC:handlerProp RDF:resource=
    	    "urn:mimetype:handler:application/testapp"/>
    	</RDF:Description> 
  • Step 4: inform Firefox this MIME type is automatically handled by an external application.
    	<RDF:Description RDF:about="urn:mimetype:handler:application/testapp"
    	  NC:alwaysAsk="false"
    	  NC:useSystemDefault="false"
    	  NC:saveToDisk="false">
    	  <NC:externalApplication RDF:resource=
    	    "urn:mimetype:externalApplication:application/testapp"/>
    	</RDF:Description> 
  • Step 5: inform Firefox which external application to use:
    	<RDF:Description
    	  RDF:about="urn:mimetype:externalApplication:application/testapp"
    	  NC:path="executable" /> 

For steps 2 and onward, snippets should be placed before the final line

	</RDF:RDF> 

You should replace the example values above with your particular values. For example, to view postscript files using ghostview (gv), you would replace

  • application/testapp with application/postscript.
  • ext1 with ps. Optionally, you could also replace ext1 with eps for excapsulated postscript, or you can leave that out.
  • executable with gv or /usr/local/bin/gv.
  • Description of MIME type with PostScript file.

Plugin Method

A much easier way, if you have the ability to install Firefox plugins, may be to install the MimeEdit plugin, which gives the user the ability to associate MIME types with application that can operate on them using a GUI. It can be found here

https://addons.mozilla.org/en-US/firefox/addon/4498
 
Top