No need for constant "GUAC" or reselection. Added oninput handler such that voice...
[guacamole.git] / src / main / webapp / client.xhtml
index 71d519d..2ac8a7a 100644 (file)
 
         </div>
 
+        <!-- Keyboard event target for platforms with native OSKs -->
+        <textarea id="eventTarget"></textarea>
 
         <!-- Display -->
-        <div id="display" class="guac-display guac-loading">
+        <div id="display">
             
             <!-- Menu trigger -->
             <div id="menuControl"></div>
 
             // Start connect after control returns from onload (allow browser
             // to consider the page loaded).
-            document.body.onload = function() {
-
+            window.onload = function() {
                 window.setTimeout(function() {
+
+                    var tunnel;
+
+                    // If WebSocket available, try to use it.
+                    if (window.WebSocket)
+                        tunnel = new Guacamole.ChainedTunnel(
+                            new Guacamole.WebSocketTunnel("websocket-tunnel"),
+                            new Guacamole.HTTPTunnel("tunnel")
+                        );
+
+                    // If no WebSocket, then use HTTP.
+                    else
+                        tunnel = new Guacamole.HTTPTunnel("tunnel")
+
                     // Instantiate client
-                    var guac = new Guacamole.Client(
-                        GuacamoleUI.display,
-                        new Guacamole.HTTPTunnel("tunnel")
-                    );
+                    var guac = new Guacamole.Client(tunnel);
+
+                    // Add client to UI
+                    guac.getDisplay().className = "software-cursor";
+                    GuacamoleUI.display.appendChild(guac.getDisplay());
 
                     // Tie UI to client
                     GuacamoleUI.attach(guac);
 
                     try {
 
-                        // Get ID
-                        var id = window.location.search.substring(1);
+                        // Get entire query string, and pass to connect().
+                        // Normally, only the "id" parameter is required, but
+                        // all parameters should be preserved and passed on for
+                        // the sake of authentication.
 
-                        // Connect client
-                        guac.connect("id=" + id);
+                        var connect_string = window.location.search.substring(1);
+                        guac.connect(connect_string);
 
                     }
                     catch (e) {
                         GuacamoleUI.showError(e.message);
                     }
-                }, 0);
 
+                }, 0);
             };
 
         /* ]]> */ </script>