Status/error refactor. Fix firefox bugs.
- All state/status updates go through updateState routine which updates the status line also. - Old firefox (and opera) don't support canvas createImageData, so use getImageData as replacement. - Add console.warn and console.error stubs so that firefox without firebug doesn't crap out. - If no WebSockets then error if no flash or if URL is location (flash will refuse to load the object for security reasons).
This commit is contained in:
34
vnc.html
34
vnc.html
@@ -7,11 +7,11 @@
|
||||
Host: <input id='host' style='width:100'>
|
||||
Port: <input id='port' style='width:50'>
|
||||
Password: <input id='password' type='password' style='width:80'>
|
||||
<input id='connectButton' type='button' value='Connect' style='width:100px'
|
||||
onclick="RFB.connect();">
|
||||
<input id='connectButton' type='button' value='Loading'
|
||||
style='width:100px' disabled>
|
||||
<br><br>
|
||||
|
||||
<div id='status'>Disconnected</div>
|
||||
<div id='status'>Loading</div>
|
||||
<canvas id="vnc" width="640" height="20"
|
||||
style="border-style: dotted; border-width: 1px;">
|
||||
Canvas not supported.
|
||||
@@ -27,6 +27,11 @@
|
||||
onblur="RFB.clipboardFocus=false;"></textarea>
|
||||
</body>
|
||||
|
||||
<!--
|
||||
<script type='text/javascript'
|
||||
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
||||
-->
|
||||
|
||||
<script src="include/mootools.js"></script>
|
||||
<script src="include/base64.js"></script>
|
||||
<script src="include/des.js"></script>
|
||||
@@ -50,15 +55,26 @@
|
||||
console.log("onload");
|
||||
if (native_ws) {
|
||||
console.log("Using native WebSockets");
|
||||
RFB.updateState('disconnected', 'Disconnected');
|
||||
} else {
|
||||
console.log("Using web-socket-js flash bridge");
|
||||
WebSocket.__swfLocation = "web-socket-js/WebSocketMain.swf";
|
||||
RFB.force_copy = true;
|
||||
if ((! Browser.Plugins.Flash) ||
|
||||
(Browser.Plugins.Flash.version < 9)) {
|
||||
RFB.updateState('failed', "WebSockets or Adobe Flash is required");
|
||||
} else if (location.href.substr(0, 7) == "file://") {
|
||||
RFB.updateState('failed', "'file://' URL is incompatible with Adobe Flash");
|
||||
} else {
|
||||
WebSocket.__swfLocation = "include/web-socket-js/WebSocketMain.swf";
|
||||
RFB.force_copy = true;
|
||||
RFB.updateState('disconnected', 'Disconnected');
|
||||
}
|
||||
}
|
||||
if (RFB.state == 'disconnected') {
|
||||
var url = document.location.href;
|
||||
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
|
||||
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
|
||||
$('password').value = (url.match(/password=([^&#]*)/) || ['',''])[1];
|
||||
}
|
||||
var url = document.location.href;
|
||||
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
|
||||
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
|
||||
$('password').value = (url.match(/password=([^&#]*)/) || ['',''])[1];
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user