Articles: How to use Firefox from external applications

As for Windows, Mac OS X and some desktop environments on GNU/Linux you would simply set a default browser for the system. However there is also a manual way of setting this option.
Added: 2005-01-02 17:34:59 - Modified: 2006-09-23 23:20:54 - Level: Intermediate
Printer friendly version PDF File
Recommend this article to a friend.

Bookmark this on google Bookmark this on del.icio.us Submit this to digg Bookmark this at yahoo Bookmark this at reddit Bookmark this at furl Search technorati for links to this page Toggle more

The actual script is as follows

#!/bin/bash

export MOZILLA_FIVE_HOME="/home/kristianf/Applications/firefox/current"

url="$1"
if [ "x$url" = "x" ]; then
url="about:blank"
else
url=http://${url##http://};
url=${url/http:\/\/https:\/\//https:\/\/}
fi

if $MOZILLA_FIVE_HOME/mozilla-xremote-client -a openURL\("$url"\); then
exit 0
fi
exec $MOZILLA_FIVE_HOME/firefox "$url"

How to use it

Mozilla Thunderbird

user_pref("network.protocol-handler.app.http","/home/kristianf/Applications/firefox_remote.sh");
user_pref("network.protocol-handler.app.https","/home/kristianf/Applications/firefox_remote.sh");

If you don't have this file in your profile directory, then create it. it itsn't there by default. As you see this file set a new protocol handeler, in this case to a shell-script making use of Mozilla's xremote procedure. The shell-script in my case look like:

X-Chat

To use it from X-Chat you would add the following to urlhandlers.conf

NAME Browser
CMD !/home/kristianf/Applications/firefox_remote.sh "%s"

As always, comments and how to do it in other applications as well are welcome.

Related articles:



[Sitemap]