Is it possible to setup host machine browser as default guest system browser

8

0

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

Posted 2012-09-12T08:23:07.067

Reputation: 217

1What is your actual question as it seems very broad? – Dave – 2012-09-12T08:29:03.243

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 – 2012-09-12T08:35:59.483

not in guest web browser, kde has got default browser app, I want to make it the host's browser. – cnd – 2012-09-12T08:38:41.193

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 – 2012-09-12T08:45:23.623

>

  • 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 – 2012-09-12T08:53:17.453

    Can you write some use cases e.g. setup: In guest, default web-browser is set to some special tool that I wrote. Case: user clicks on a link outside of a web-browser, the special tool causes the page to be loaded in hosts web-browser, and focus to be switch to host web-browser. – ctrl-alt-delor – 2012-09-12T08:58:36.523

    @richard added to question – cnd – 2012-09-12T09:04:07.413

    Answers

    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.

    Axel Isouard

    Posted 2012-09-12T08:23:07.067

    Reputation: 271

    What do you think maybe it could be possible using Virtualbox API? Adding yet another service (ssh) is a overhead ) – cnd – 2012-09-12T09:24:23.963

    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 – 2012-09-12T09:25:42.183

    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 – 2012-09-12T09:36:17.620

    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.

    Axel Isouard

    Posted 2012-09-12T08:23:07.067

    Reputation: 271

    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 – 2012-09-12T08:44:12.950

    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 – 2012-09-12T08:45:43.313

    yes, for example in my IRC client application. – cnd – 2012-09-12T08:46:34.353

    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 – 2012-09-12T08:47:49.717

    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 – 2012-09-12T08:55:09.373

    Oh I completely get it now, alright, you'll simply have to change your default web browser with a single script, it should put the url in the first argument, ie if your script is called sendurl.sh and if you click on www.google.com, then KDE will execute it as 'sendurl.sh http://www.google.com ' , if it doesn't work, try with Kmenu > Configure Desktop > Advanced > File Assoc > Text > HTML, this would be a lot easier indeed.

    – Axel Isouard – 2012-09-12T08:59:41.070

    first.. I need this sendurl.sh and then I want to promote it as browser for kde so I can chose it from default ones :P – cnd – 2012-09-12T09:01:57.713

    Alright, I'm writing another answer for that. – Axel Isouard – 2012-09-12T09:04:06.727

    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

    Posted 2012-09-12T08:23:07.067

    Reputation: 825