]> git.proxmox.com Git - mirror_novnc.git/blob - vnc_auto.html
Sync more header meta stuff from vnc.html:
[mirror_novnc.git] / vnc_auto.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4
5 <!--
6 noVNC example: simple example using default UI
7 Copyright (C) 2012 Joel Martin
8 noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
9 This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
10
11 Connect parameters are provided in query string:
12 http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1
13 -->
14 <title>noVNC</title>
15
16 <meta charset="utf-8">
17
18 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
19 Remove this if you use the .htaccess -->
20 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
21
22 <!-- Apple iOS Safari settings -->
23 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
24 <meta name="apple-mobile-web-app-capable" content="yes" />
25 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
26 <!-- App Start Icon -->
27 <link rel="apple-touch-startup-image" href="images/screen_320x460.png" />
28 <!-- For iOS devices set the icon to use if user bookmarks app on their homescreen -->
29 <link rel="apple-touch-icon" href="images/screen_57x57.png">
30 <!--
31 <link rel="apple-touch-icon-precomposed" href="images/screen_57x57.png" />
32 -->
33
34
35 <!-- Stylesheets -->
36 <link rel="stylesheet" href="include/base.css" title="plain">
37
38 <!--
39 <script type='text/javascript'
40 src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
41 -->
42 <script src="include/util.js"></script>
43 </head>
44
45 <body style="margin: 0px;">
46 <div id="noVNC_screen">
47 <div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
48 <table border=0 width="100%"><tr>
49 <td><div id="noVNC_status">Loading</div></td>
50 <td width="1%"><div id="noVNC_buttons">
51 <input type=button value="Send CtrlAltDel"
52 id="sendCtrlAltDelButton">
53 </div></td>
54 </tr></table>
55 </div>
56 <canvas id="noVNC_canvas" width="640px" height="20px">
57 Canvas not supported.
58 </canvas>
59 </div>
60
61 <script>
62 /*jslint white: false */
63 /*global window, $, Util, RFB, */
64 "use strict";
65
66 // Load supporting scripts
67 Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
68 "input.js", "display.js", "jsunzip.js", "rfb.js"]);
69
70 var rfb;
71
72 function passwordRequired(rfb) {
73 var msg;
74 msg = '<form onsubmit="return setPassword();"';
75 msg += ' style="margin-bottom: 0px">';
76 msg += 'Password Required: ';
77 msg += '<input type=password size=10 id="password_input" class="noVNC_status">';
78 msg += '<\/form>';
79 $D('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
80 $D('noVNC_status').innerHTML = msg;
81 }
82 function setPassword() {
83 rfb.sendPassword($D('password_input').value);
84 return false;
85 }
86 function sendCtrlAltDel() {
87 rfb.sendCtrlAltDel();
88 return false;
89 }
90 function updateState(rfb, state, oldstate, msg) {
91 var s, sb, cad, level;
92 s = $D('noVNC_status');
93 sb = $D('noVNC_status_bar');
94 cad = $D('sendCtrlAltDelButton');
95 switch (state) {
96 case 'failed': level = "error"; break;
97 case 'fatal': level = "error"; break;
98 case 'normal': level = "normal"; break;
99 case 'disconnected': level = "normal"; break;
100 case 'loaded': level = "normal"; break;
101 default: level = "warn"; break;
102 }
103
104 if (state === "normal") { cad.disabled = false; }
105 else { cad.disabled = true; }
106
107 if (typeof(msg) !== 'undefined') {
108 sb.setAttribute("class", "noVNC_status_" + level);
109 s.innerHTML = msg;
110 }
111 }
112
113 window.onscriptsload = function () {
114 var host, port, password, path, token;
115
116 $D('sendCtrlAltDelButton').style.display = "inline";
117 $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
118
119 WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
120 document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
121 // By default, use the host and port of server that served this file
122 host = WebUtil.getQueryVar('host', window.location.hostname);
123 port = WebUtil.getQueryVar('port', window.location.port);
124
125 // If a token variable is passed in, set the parameter in a cookie.
126 // This is used by nova-novncproxy.
127 token = WebUtil.getQueryVar('token', null);
128 if (token) {
129 WebUtil.createCookie('token', token, 1)
130 }
131
132 password = WebUtil.getQueryVar('password', '');
133 path = WebUtil.getQueryVar('path', 'websockify');
134
135 if ((!host) || (!port)) {
136 updateState('failed',
137 "Must specify host and port in URL");
138 return;
139 }
140
141 rfb = new RFB({'target': $D('noVNC_canvas'),
142 'encrypt': WebUtil.getQueryVar('encrypt',
143 (window.location.protocol === "https:")),
144 'repeaterID': WebUtil.getQueryVar('repeaterID', ''),
145 'true_color': WebUtil.getQueryVar('true_color', true),
146 'local_cursor': WebUtil.getQueryVar('cursor', true),
147 'shared': WebUtil.getQueryVar('shared', true),
148 'view_only': WebUtil.getQueryVar('view_only', false),
149 'updateState': updateState,
150 'onPasswordRequired': passwordRequired});
151 rfb.connect(host, port, password, path);
152 };
153 </script>
154
155 </body>
156 </html>