running mozilla multiple times

I’ve found that with recent (1.6, 1.7) versions of Mozilla on Linux, you aren’t able to run multiple instances of the browser. If Mozilla is already running and you try to run Mozilla again, you get the Profile Manager which is a nuisance and of little use.

My solution was to write a shell script to determine if an instance is already running. If it is it opens a new window and if it isn’t, it runs mozilla normally. It’s quite simple but I thought it might come in handy for others, so here it is.

# Run Mozilla normally if there are no other instances.  If there are, open
#   a new window within the running instance.
pgrep -f $mozilla 1> /dev/null 2>&1
if [ "$?" == 0 ]; then
    $mozilla -remote "openURL(about:blank, new-window)"

Make sure the path to mozilla is correct, and if you want to open a new tab instead of a new window, change new-window to new-tab.


 (Post a comment) | Comments RSS feed
  1. I’ve had the same issue before. I just made sure I always had the mail window open, and then I had a hotkey set up to do a remote openURL to open a browser, but this is better.

    Comment by Cameron on June 28, 2004 @ 8:06 pm
  2. I had a similar problem and his is how i solved it:

    Comment by Thejaswi on June 29, 2004 @ 12:51 am
  3. Thank you very much for this posting. The script was quite helpful. I just do not understand why mozilla was this quirky behavior exists.

    Comment by Eric Hawken on July 22, 2004 @ 12:43 pm
  4. Its easier than that. I just set up my desktop Mozilla link to execute /home/user/mozilla/mozilla -remote “oenURL(about:blank, new-window)” and it does the same thing without having to make a script.

    Comment by W.C. on August 12, 2004 @ 2:19 pm
  5. Oops spoke to soon. It works when you have an instance already running but doesn’t work opening a window from scratch when you have the -remote flag on there.

    Comment by W.C. on August 12, 2004 @ 2:26 pm
  6. Yup, the -remote option is allowing you to run a command in an existing instance of Mozilla, so if Mozilla isn’t running, the command returns:

    Error: No running window found.

    Comment by dan on August 12, 2004 @ 2:26 pm

Comments are closed