Configuring Your .mailcap for Netscape and other programs

Overview: many programs on a typical unix system use the .mailcap mechanism to determine what helper program to invoke for a particular file. For example, when netscape attempts to open a PDF file, it consults your mailcap file (/etc/mailcap first, then /.mailcap) to find a pdf viewer to launch. This would typically be xpdf.

A problem occurs if you really try to get fancy with your .mailcap and use it with a lot of programs. You will find that conflicts arise between programs, particularly with netscape. Fox example, it is convenient to have a mailcap entry which attempts to decode files of type application/octet-stream via a helper program. Netscape will choke on this.

The solution is a mailcap file for netscape, and a mailcap file for everyone else. Steps:

1. Create a /.mailcap-netscape and put something like the following in it:

 application/postscript;gv -safer %s
 application/pdf;xpdf -q %s
 image/tiff;ee %s
 audio/basic;esdplay %s
 audio/x-mpeg;xmms %s
 audio/x-wav;xmms %s
 audio/x-pn-realaudio; /usr/X11R6/bin/realplay %s
 audio/vnd.rn-realaudio; /usr/X11R6/bin/realplay %u
 application/smil; /usr/X11R6/bin/realplay %u
 application/x-mplayer; /usr/X11R6/bin/realplay %u
 audio/x-pn-mp3; /usr/X11R6/bin/realplay %u
 video/mpeg;xine -s %s
 audio/mpeg;xmms %s

2. Stop netscape and modify the file ~/.netscape/preferences.js. Add the line

 user_pref("helpers.private_mailcap_file", "/home/phil/.mailcap-netscape");

Note that netscape must be stopped when you do this, otherwise it will remove the new entry on shutdown.

3. That's it. Restart netscape and it should use the new file.

--phil 10/22/2001


Our Founder
ToolboxClick to hide/show
RecentChanges Click to hide/show