]> git.proxmox.com Git - mirror_novnc.git/blobdiff - vnc_lite.html
Consistently close dialogs on connect/disconnect
[mirror_novnc.git] / vnc_lite.html
index 88e10797dbe1504039fdb95eda6b0ae877bee62e..d17ab9ee458da78fde2bf35a6308818928dcbfe2 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html lang="en">
 <head>
 
     <!--
@@ -7,8 +7,7 @@
 
     This is a self-contained file which doesn't import WebUtil or external CSS.
 
-    Copyright (C) 2012 Joel Martin
-    Copyright (C) 2018 Samuel Mannehed for Cendio AB
+    Copyright (C) 2019 The noVNC Authors
     noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
     This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
 
 
     <meta charset="utf-8">
 
-    <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
-                Remove this if you use the .htaccess -->
-    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <!-- Always force latest IE rendering engine (even in intranet) &
+                Chrome Frame. Remove this if you use the .htaccess -->
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 
-    <style type="text/css">
+    <style>
 
         body {
             margin: 0;
             height: 100%;
         }
 
-        #noVNC_status_bar {
+        #top_bar {
             background-color: #6e84a3;
             color: white;
             font: bold 12px Helvetica;
             padding: 6px 5px 4px 5px;
             border-bottom: 1px outset;
         }
-        #noVNC_status {
+        #status {
             text-align: center;
         }
         #sendCtrlAltDelButton {
             cursor: pointer;
         }
 
+        #screen {
+            flex: 1; /* fill remaining space */
+            overflow: hidden;
+        }
+
     </style>
 
     <!-- Promise polyfill for IE11 -->
     <script src="vendor/promise.js"></script>
 
     <!-- ES2015/ES6 modules polyfill -->
-    <script type="module">
-        window._noVNC_has_module_support = true;
-    </script>
-    <script>
-        window.addEventListener("load", function() {
-            if (window._noVNC_has_module_support) return;
-            const loader = document.createElement("script");
-            loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
-            document.head.appendChild(loader);
-        });
-    </script>
+    <script nomodule src="vendor/browser-es-module-loader/dist/browser-es-module-loader.js"></script>
 
     <!-- actual script modules -->
     <script type="module" crossorigin="anonymous">
 
         // Show a status text in the top bar
         function status(text) {
-            document.getElementById('noVNC_status').textContent = text;
+            document.getElementById('status').textContent = text;
         }
 
         // This function extracts the value of one variable from the
             // because Firefox < 53 has a bug w.r.t location.search
             const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
                   match = document.location.href.match(re);
-            if (typeof defaultValue === 'undefined') { defaultValue = null; }
 
             if (match) {
                 // We have to decode the URL since want the cleartext value
             return defaultValue;
         }
 
-        document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
+        document.getElementById('sendCtrlAltDelButton')
+            .onclick = sendCtrlAltDel;
 
         // Read parameters specified in the URL query string
         // By default, use the host and port of server that served this file
         const host = readQueryVariable('host', window.location.hostname);
         let port = readQueryVariable('port', window.location.port);
-        const password = readQueryVariable('password', '');
+        const password = readQueryVariable('password');
         const path = readQueryVariable('path', 'websockify');
 
         // | | |         | | |
         url += '/' + path;
 
         // Creating a new RFB object will start a new connection
-        rfb = new RFB(document.body, url,
+        rfb = new RFB(document.getElementById('screen'), url,
                       { credentials: { password: password } });
 
         // Add listeners to important events from the RFB module
 </head>
 
 <body>
-  <div id="noVNC_status_bar">
-    <div id="noVNC_status">Loading</div>
-    <div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
-  </div>
+    <div id="top_bar">
+        <div id="status">Loading</div>
+        <div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
+    </div>
+    <div id="screen">
+        <!-- This is where the remote screen will appear -->
+    </div>
 </body>
 </html>