How do I create a launcher / script that opens an URL in TorBrowser (from the bundle)

  • If I do tor-browser_en-US/App/Firefox/firefox-bin http://example.com it opens in my regular Firefox browser. Is there a way to make a launcher/script that opens a link in the Tor Browser?

  • pabouk

    pabouk Correct answer

    9 years ago

    Currently the start-tor-browser script and vidalia form the Tor Browser Bundle is not prepared to pass arguments to the launched Firefox. See this part of the script (near to the end):

    printf "\nLaunching Tor Browser Bundle for Linux in ${HOME}\n"
    cd "${HOME}"
    # XXX Someday we should pass whatever command-line arguments we got
    # (probably filenames or URLs) to Firefox.
    ./App/vidalia --datadir Data/Vidalia/ -style Cleanlooks
    

    The last command results in launching Firefox.

    It is possible to close the browser launched through vidalia and then to start it manually. Here is a procedure:

    1. Copy the start-tor-browser script to start-tor-browser-only.
    2. In start-tor-browser-only replace the line ./App/vidalia --datadir Data/Vidalia/ -style Cleanlooks near to the end by ./App/Firefox/firefox -no-remote -profile Data/profile "[email protected]"
    3. Make sure that the executable bit is set: chmod a+x start-tor-browser-only
    4. Run the start-tor-browser script.
    5. Close the browser window. Now just the tor daemon and vidalia are running. Processes can communicate through tor by using it as a socks proxy.
    6. Start start-tor-browser-only http://your.address.

    This way you can start the Firefox with parameters as you want. It will be started with the correct profile and correct environment variables: HOME, XAUTHORITY, LD_LIBRARY_PATH and LDPATH. Unfortunately the debug mode will not work and probably there would be several other minor catches and security implications.

    For one, you won't be starting the browser with the environment variables that tell the Torbutton Firefox extension how to talk to Tor's control port. That means when you click 'new identity' in Torbutton, it won't be able to tell Tor to rotate to fresh circuits. So this is a fine hack if you want to play around with it, but it seems a poor choice for normal users.

    Also, I'd encourage people to investigate this question in the context of TBB 3.x, which doesn't have Vidalia anymore and is simply the browser: https://blog.torproject.org/category/tags/tbb-30

    It at least lets me avoid having to restart vidalia if I've quit the browser, so that's a timesaver. I was hoping there was a way to open an URL in the _running_ browser (ie. without the "-no-remote"), but I guess that's not possible yet.

    @unhammer: If you want you can remove the `-no-remote` parameter in `start-tor-browser-only` then you can control the Tor Firefox browser by running `firefox` but there is a risk that you open some URLs through Tor though they should have been opened in clear and vice versa. Unfortunately `-no-remote` seems to be hardcoded in the binaries launching the first instance of Firefox.

    On my system I get `Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.` if I'm running just Tor Browser, while it opens in the regular Firefox if I'm running that as well.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM