So I want to be redirected to my host system browser when I click some link in guest system.

Note that I don't want to have browser on guest system at all.

Host: Windows 7

Guest: GNU/Linux & KDE

Use case: I have 2 monitors, one is for Linux (Running in VirtualBox) but I want to have one browser for both so when I click on some link in Linux IRC client I want this link to be opened in running browser on host system.

  • 1
    What is your actual question as it seems very broad? – Dave Sep 12 '12 at 8:29
  • Clarification: Are you saying, “When I am in Guest Gnu/Linux web-browser, and I click a specific link, then minimise the guest, maximise the host web-browser, and open the specific page”. Or “When I am in Guest Gnu/Linux web-browser, and I click a specific link, open a page hosted on the host.” Or how to I browse host files from guest, Or something else. – ctrl-alt-delor Sep 12 '12 at 8:35
  • not in guest web browser, kde has got default browser app, I want to make it the host's browser. – cnd Sep 12 '12 at 8:38
  • You are going to have to tell me what you want, I can't guess. So 1) KDE has an tool to set the default web-browser. is that correct? 2) You want the host to use the some browser, as set up in guest kde. is that correct? – ctrl-alt-delor Sep 12 '12 at 8:45
  • 1) Yes, KDE is major DE so settings -> default applications -> web browser 2) not, I want the links to be opened it host's web browser when I want to open some link from guest. – cnd Sep 12 '12 at 8:53

Another answer due to some clarifications below.

As you said, you can create a little script and set it as your default browser in your KDE settings. To make these things in the easiest way possible, you should simply send the firefox command to your host machine over SSH. Here's a link describing how to setup a SSH server on Windows 7, http://codeoptimism.com/2010/10/08/SSH-on-Windows-7-the-full-awesome-implementation

Then the script would be as simple as that (don't forget to allow execution) :

ssh user@ '/c/Program\ Files/Mozilla\ Firefox/firefox.exe $1'

Run this command before using it as your default web browser, as you would have to add the machine in your known hosts list. You will have to set up a public key authentication too, so it doesn't prompt the password.

KDE4 shoud let you specify the script's path to be run each time you click on a link.

| improve this answer | |
  • What do you think maybe it could be possible using Virtualbox API? Adding yet another service (ssh) is a overhead ) – cnd Sep 12 '12 at 9:24
  • I've just took a look on it, this API would be useful only on the hardware side, such as controlling mouse, keyboard, bios,... You can bind the events on the mouse with it, but it would only return the mouse's relative or absolute coordinates. – Axel Isouard Sep 12 '12 at 9:25
  • I still doubt about it but maybe you are right and ssh is the only way of running something on host but that is sad, running ssh server on host machine is not really what I wanted but that is solution and fully feet the question. Maybe I will realize it some later, thank you. – cnd Sep 12 '12 at 9:36

There aren't any popular solutions online for that, but I think you could try to create two plugins (with Greasemonkey, NPAPI or FireBreath), and it would be a little harder since your host machine is Windows 7 as I don't know any way to execute a command remotely like using SSH.

  • One for your host system, that listens to a port for incoming connections, and get the order to navigate through a link you will click in your guest system's web browser.

  • Another one for your guest system, which will connect to your listener and send a packet containing the link to go through.

If you feel alright with this solution and ready to start, I suggest you to ask StackOverflow if you need some help while doing it.

Good luck.

| improve this answer | |
  • Virtualbox is not ssh... I need to hook when the link is coming to browser then redirect it to VirtualBox somehow - so there are 2 different sides of the question. Maybe I shell ask about it on Stackoverflow because it's about VBox API and scripting? – cnd Sep 12 '12 at 8:44
  • You don't want to have a browser in your guest machine, would you like to click links appearing in terminals or other applications ? – Axel Isouard Sep 12 '12 at 8:45
  • yes, for example in my IRC client application. – cnd Sep 12 '12 at 8:46
  • Okay, it would completely depend from the IRC application, you will have to do the same thing as I said for every kind of application you would like to be redirected, I really don't know any way to detect a mouse click on a link in a generic manner. – Axel Isouard Sep 12 '12 at 8:47
  • no need to detect a mouse click or make it for any application I want to replace default web browser application with some kind of script that will redirect me (somehow) to the host. – cnd Sep 12 '12 at 8:55

On one system make a daemon that listens to requests and opens URLs in a browser.
On the other system set your default browser to something that invokes such a request.

So the first part of this is an HTTP server that listens to requests on the machine where you want to open the browser. On an incoming request it opens (in a browser) the URL given as an argument of a POST request.

Pick one:

You should add this script to startup, it's supposed to run in the background.

The second part is something that invokes the request.

Pick one:

You should designate this script as your default browser.
In KDE: Default Applications → Web Browser

It can also be used as a command line tool: ./open_url.sh 'http://google.com/'

The Python scripts should work on all major systems with any reasonably recent Python version (I suspect 2.6+, 3.1+).

On Windows, if you don't want a Python script to run in a command window, you should change its extension to .pyw. Use Task Manager if you want to stop it (look for pythonw.exe).

VirtualBox network adapter should be set to NAT (default setting). More about the IP address here. The choice of port is arbitrary, feel free to change 1337 to something else everywhere.

The server is secure because it listens only to connections from localhost. VirtualBox makes it work somehow. But if you want this to work remotely, specify the listening IP address as '' or '' instead of 'localhost'.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.