summaryrefslogtreecommitdiffstats
path: root/webclients
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2012-03-09 15:35:53 +0100
committerChristian Beier <dontmind@freeshell.org>2012-03-09 15:35:53 +0100
commitb7e043abad2d3ab7b6e60e6a6c16f6ff25caa0e0 (patch)
tree63b211bda8f3f39b55e4b70e44e2ddaa4ca2c991 /webclients
parente7dfd0a9d66637ff9ee33132a6f0bd07083aec86 (diff)
downloadlibtdevnc-b7e043abad2d3ab7b6e60e6a6c16f6ff25caa0e0.tar.gz
libtdevnc-b7e043abad2d3ab7b6e60e6a6c16f6ff25caa0e0.zip
IPv6 support for LibVNCServer, part twopointone: properly surround IPv6 addresses with [] for noVNC URL.
Some browsers omit the square brackets in document.location.hostname, so add them if missing.
Diffstat (limited to 'webclients')
-rw-r--r--webclients/index.vnc10
1 files changed, 9 insertions, 1 deletions
diff --git a/webclients/index.vnc b/webclients/index.vnc
index 8254a70..0a92bd4 100644
--- a/webclients/index.vnc
+++ b/webclients/index.vnc
@@ -22,7 +22,15 @@ If the above Java applet does not work, you can also try the new JavaScript-only
<script language="JavaScript">
<!--
function start_novnc(){
- open("novnc/vnc_auto.html?host=" + document.location.hostname + "&port=$PORT&true_color=1");
+ var host = document.location.hostname;
+ // If there are at least two colons in there, it is likely an IPv6 address. Check for square brackets and add them if missing.
+ if(host.search(/^.*:.*:.*$/) != -1) {
+ if(host.charAt(0) != "[")
+ host = "[" + host;
+ if(host.charAt(host.length-1) != "]")
+ host = host + "]";
+ }
+ open("novnc/vnc_auto.html?host=" + host + "&port=$PORT&true_color=1");
}
-->
</script>