From MozillaZine Knowledge Base
Configure each external program to pass the URL to this Bourne shell script:
#!/bin/sh
#
# This script allows external apps to open new URLs in Firefox
# or open a new instance of Firefox if it isn't already started
#
/path/to/firefox/firefox -a firefox -remote "openURL($@,new-tab)" ||
exec /path/to/firefox/firefox "$@";
This shell script takes advantage of the Mozilla IPC protocol to either open the external URL in an already active Firefox instance, or start a new instance of Firefox.
To make this script work with Mozilla, replace all instances of "firefox" with "mozilla".