SOLUTION Firefox 0.9 Linux remote script (how to make default browser)

Discussion in 'Firefox' started by maxo, Jun 17, 2004.

  1. maxo

    maxo Guest

    I know this is heavily cross posted, but it seemed like a important enough
    thing. ;) :D

    For the not so tech savvy: this is how to tell your desktop environment to
    launch Firefox when needed from another program, or if it's already
    launched, to open a new tab with the requested URL.

    Any other Linux users having problems with -remote, I came across a solution on the Firefox Bugs forum.

    Before:

    CODE
    code:
    firefox -remote 'ping()'
    firefox -remote 'openURL(http://www.somethingawful.com/, new-tab)'



    After:

    CODE
    code:
    firefox -a firefox -remote 'ping()'
    firefox -a firefox -remote 'openURL(http://www.somethingawful.com/, new-tab)'



    In practice you would create a script like this and tell either KDE or
    Gnome to use it as the default browser, I call mine .firefox.sh and put it
    in my home directory.

    this would work for Firefox 0.8 or earlier

    #!/bin/sh
    MOZILLA="/usr/bin/firefox"
    if $MOZILLA -remote "ping()" 2>/dev/null
    then
    echo "Mozilla already launch"
    location=",new-tab"
    exec $MOZILLA -remote "openURL($1$location)"
    else
    exec $MOZILLA "[email protected]"
    fi
    exit 1


    For Firefox 0.9 you would use this

    #!/bin/sh
    MOZILLA="/usr/bin/firefox"
    if $MOZILLA -a firefox -remote "ping()" 2>/dev/null
    then
    echo "Mozilla already launch"
    location=",new-tab"
    exec $MOZILLA -a firefox-remote "openURL($1$location)"
    else
    exec $MOZILLA "[email protected]"
    fi
    exit 1


    I hope this helps.

    :D
     
    maxo, Jun 17, 2004
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.