Commit b7e043ab authored by Christian Beier's avatar Christian Beier

IPv6 support for LibVNCServer, part twopointone: properly surround IPv6...

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.
parent e7dfd0a9
...@@ -22,7 +22,15 @@ If the above Java applet does not work, you can also try the new JavaScript-only ...@@ -22,7 +22,15 @@ If the above Java applet does not work, you can also try the new JavaScript-only
<script language="JavaScript"> <script language="JavaScript">
<!-- <!--
function start_novnc(){ 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> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment