mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
88 lines
2.6 KiB
HTML
88 lines
2.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
<html>
|
|
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="guacamole.css"/>
|
|
<title>Guacamole (EXAMPLE)</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- Display -->
|
|
<div id="display"></div>
|
|
|
|
<!-- Guacamole JavaScript API -->
|
|
<script type="text/javascript"
|
|
src="guacamole-common-js/all.min.js"></script>
|
|
|
|
<!-- Init -->
|
|
<script type="text/javascript"> /* <![CDATA[ */
|
|
|
|
// Get display div from document
|
|
var display = document.getElementById("display");
|
|
|
|
// Instantiate client, using an HTTP tunnel for communications.
|
|
var guac = new Guacamole.Client(
|
|
new Guacamole.HTTPTunnel("tunnel")
|
|
);
|
|
|
|
// Add client to display div
|
|
display.appendChild(guac.getDisplay().getElement());
|
|
|
|
// Error handler
|
|
guac.onerror = function(error) {
|
|
alert(error);
|
|
};
|
|
|
|
// Connect
|
|
guac.connect();
|
|
|
|
// Disconnect on close
|
|
window.onunload = function() {
|
|
guac.disconnect();
|
|
}
|
|
|
|
// Mouse
|
|
var mouse = new Guacamole.Mouse(guac.getDisplay().getElement());
|
|
|
|
mouse.onmousedown =
|
|
mouse.onmouseup =
|
|
mouse.onmousemove = function(mouseState) {
|
|
guac.sendMouseState(mouseState);
|
|
};
|
|
|
|
// Keyboard
|
|
var keyboard = new Guacamole.Keyboard(document);
|
|
|
|
keyboard.onkeydown = function (keysym) {
|
|
guac.sendKeyEvent(1, keysym);
|
|
};
|
|
|
|
keyboard.onkeyup = function (keysym) {
|
|
guac.sendKeyEvent(0, keysym);
|
|
};
|
|
|
|
/* ]]> */ </script>
|
|
|
|
</body>
|
|
|
|
</html>
|