8

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.

cnd
  • 217

3 Answers3

5

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) :

#!/bin/sh
ssh user@192.168.1.20 '/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.

1

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.

0

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 '0.0.0.0' or '' instead of 'localhost'.

Oleh Prypin
  • 1,252