2012年3月4日星期日

Fw: How to connect to KVM guest (spice support) via Firefox

I found a good example from mailist of freedesktop.org:
http://lists.freedesktop.org/archives/spice-devel/2011-June/003959.html

It's pretty straight forward:
  1. install spice-xpi plugin to firefox: sudo yum install spice-xpi
  2. make a sample html file like this:

<!DOCTYPE html>
<html>
<head>
<title>SPICE Plugin Test</title>
<script type="text/javascript">
    function connectvm()
    {
        var ip = String("localhost");
        var port = String("5900");
        var passwd = String("pass at 321");
        var pluginobj = document.embeds[0];

        pluginobj.hostIP = ip;
        pluginobj.port = port;
        //pluginobj.Password = passwd;
        //pluginobj.fullScreen = true;
        pluginobj.UsbListenPort = 0;
        pluginobj.connect();
    }
</script>
</head>
<body>
        <p>
        <embed type="application/x-spice"></embed>
        <button onclick='connectvm()'>connect to VM</button>
        </p>
        <p>
            If the plugin is working correctly, a click on the button
should open spice client.
        </p>
</body>
</html>

then it will fork a spicec process connected to the VM where spice server listens to localhost:5900
--
朱可
http://shawnzhu.blogspot.com