We currently are using a VNC java applet that is called by javascript code on our website.
I have been trying to integrate noVNC into our website so that we can move away from the using java.
I have modeled my code on the vnc_auto.html provided with the noVNC project. The problem that I am having is that
the view opens and then is immediately closed, repeating until terminated. Using firebug to set break points, I can get the screen painted from the
vnc servers output, but continuing the code results in the screen being cleared and then repainted.
Firebug console output does not give any errors at first, but then gives a 1006 error which changes to 1011.
Below is the html and java script code that is relevant and I have attached the firebug console output. I have turned on much of the debugging output
in the noVNC code, so the console output is rather long.
Please advise on how I may correct this problem.
Thank you,
Jeff Forbes
calling html
---------
<!DOCTYPE html>
<html>
<head>
<title>TEST</title>
<script type="text/javascript" src="/_novnc/util.js"></script>
<script type="text/javascript" src="/_novnc/webutil.js"></script>
<script type="text/javascript" src="/_novnc/base64.js"></script>
<script type="text/javascript" src="/_novnc/websock.js"></script>
<script type="text/javascript" src="/_novnc/webutil.js"></script>
<script type="text/javascript" src="/_novnc/des.js"></script>
<script type="text/javascript" src="/_novnc/input.js"></script>
<script type="text/javascript" src="/_novnc/display.js"></script>
<script type="text/javascript" src="/_novnc/jsunzip.js"></script>
<script type="text/javascript" src="/_novnc/rfb.js"></script>
<script type="text/javascript" src="/_view/virtDisplayVNC.js"></script>
<link href="/style/virtDisplay.css" type="text/css" rel="stylesheet" />
</head>
<body style="margin: 0; padding: 0;">
<script type="text/javascript" src="/_js/Geometry.js"></script>
<div id="mainNavWrapper"></div>
<div style="clear: both;"></div>
<h1 id="statusMsg" align="center"></h1>
<div id="virtuals"></div>
<div id="noVNC_screen">
<div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
<table border=0 width="100%"><tr>
<td><div id="noVNC_status">Loading</div></td>
<td width="1%"><div id="noVNC_buttons">
<input type=button value="Send CtrlAltDel"
id="sendCtrlAltDelButton">
</div></td>
</tr></table>
</div>
<canvas id="noVNC_canvas" width="640px" height="20px">
Canvas not supported.
</canvas>
</div>
</body>
</html>
--------
java script making the call to noVNC
/******************************************************************************
virtDisplayVNC.js
******************************************************************************/
// jsVNC parameters here
var INCLUDE_URI = vncCodebase; // location of the jsVNC support scripts. Variable found in util.js.
// Setup jsVNC as in the noVNC projects vnc_auto.html
// First load util.js into the header block
// Based on the vnc_auto.html file in the noVNC distribution
/*jslint white: false */
/*global window, $, Util, RFB, */
"use strict";
// Load supporting scripts
// Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
// "input.js", "display.js", "jsunzip.js", "rfb.js"]);
var rfb;
var disp;
console.log ($D('noVNC_canvas'));
// console.log (document.getElementById('noVNC_canvas'));
function sendCtrlAltDel() {
rfb.sendCtrlAltDel();
return false;
}
function updateState(rfb, state, oldstate, msg) {
var s, sb, cad, level;
s = $D('noVNC_status');
sb = $D('noVNC_status_bar');
cad = $D('sendCtrlAltDelButton');
switch (state) {
case 'failed': level = "error"; break;
case 'fatal': level = "error"; break;
case 'normal': level = "normal"; break;
case 'disconnected': level = "normal"; break;
case 'loaded': level = "normal"; break;
default: level = "warn"; break;
}
if (state === "normal") { cad.disabled = false; }
else { cad.disabled = true; }
if (typeof(msg) !== 'undefined') {
sb.setAttribute("class", "noVNC_status_" + level);
s.innerHTML = msg;
}
}
// window.onscriptsload = function () {
var host, port, password, path, token;
/* keep these lines in case we want to have a button to send ctrlAltDel */
$D('sendCtrlAltDelButton').style.display = "inline";
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
WebUtil.init_logging(WebUtil.getQueryVar('logging', 'debug'));
/* document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));*/
rfb = new RFB({'target': $D('noVNC_canvas'), // VNC display rendering Canvas object
'encrypt': vncEncrypt, // Use TLS/SSL/wss encryption
'true_color': true, // Request true color pixel data
'local_cursor': true, // Request locally rendered cursor
'shared': true, // Request shared mode
'view_only': viewOnly, // Disable client mouse/keyboard
'connectTimeout': 10, // Time (s) to wait for connection
'updateState': updateState});
console.log (vncHost, vncPort, virtInfo.vncauth, vncPath);
rfb.connect(vncHost, vncPort, virtInfo.vncauth, vncPath);
// }
}
}