Jelajahi Sumber

Add Chrome Frame support. Close requests in web.py.

- Add meta tag to vnc.html and vnc_auto.html so that if Chrome Frame
  is installed, it is used.

- Add detection to default_controls.js that shows a message with
  a Chrome Frame install link if the user is using a version of IE
  without Canvas support.

- Fix web.py so that requests have their connection closed after they
  are completed.  This has been a bug for a while but it prevents
  Chrome Frame from working because Chrome Frame doesn't activate
  until the initial request connection closes.
Joel Martin 14 tahun lalu
induk
melakukan
e66f3f89f2
4 mengubah file dengan 21 tambahan dan 4 penghapusan
  1. 16 2
      include/default_controls.js
  2. 1 0
      utils/web.py
  3. 2 1
      vnc.html
  4. 2 1
      vnc_auto.html

+ 16 - 2
include/default_controls.js

@@ -15,12 +15,26 @@ settingsOpen : false,
 
 
 // Render default controls and initialize settings menu
 // Render default controls and initialize settings menu
 load: function(target) {
 load: function(target) {
-    var html, i, DC = DefaultControls, sheet, sheets, llevels;
+    var html = '', i, DC = DefaultControls, sheet, sheets, llevels;
 
 
     /* Populate the 'target' DOM element with default controls */
     /* Populate the 'target' DOM element with default controls */
     if (!target) { target = 'vnc'; }
     if (!target) { target = 'vnc'; }
 
 
-    html = "";
+    if ((!document.createElement('canvas').getContext) &&
+        window.ActiveXObject) {
+        // Suggest Chrome frame for Internet Explorer users
+        html += '<center><div style="text-align: left; width: 400px">';
+        html += '  You are using a version of Internet Explorer ';
+        html += '  that does not have HTML5 Canvas support. ';
+        html += '  To use noVNC you must use a browser with HTML5 ';
+        html += '  Canvas support or install ';
+        html += '  <a href="http://google.com/chromeframe" target="cframe">';
+        html += '  Google Chrome Frame.</a>';
+        html += '</div></center>';
+        $(target).innerHTML = html;
+        return;
+    }
+
     html += '<div id="VNC_controls">';
     html += '<div id="VNC_controls">';
     html += '  <ul>';
     html += '  <ul>';
     html += '    <li>Host: <input id="VNC_host"></li>';
     html += '    <li>Host: <input id="VNC_host"></li>';

+ 1 - 0
utils/web.py

@@ -17,6 +17,7 @@ import SimpleHTTPServer as server  # python 2.X
 def do_request(connstream, from_addr):
 def do_request(connstream, from_addr):
     x = object()
     x = object()
     server.SimpleHTTPRequestHandler(connstream, from_addr, x)
     server.SimpleHTTPRequestHandler(connstream, from_addr, x)
+    connstream.close()
 
 
 def serve():
 def serve():
     bindsocket = socket.socket()
     bindsocket = socket.socket()

+ 2 - 1
vnc.html

@@ -5,7 +5,8 @@
     Licensed under LGPL-3 (see LICENSE.txt)
     Licensed under LGPL-3 (see LICENSE.txt)
     -->
     -->
     <head>
     <head>
-        <title>VNC Client</title>
+        <title>noVNC</title>
+        <meta http-equiv="X-UA-Compatible" content="chrome=1">
         <link rel="stylesheet" href="include/plain.css">
         <link rel="stylesheet" href="include/plain.css">
         <link rel="alternate stylesheet" href="include/black.css" TITLE="Black">
         <link rel="alternate stylesheet" href="include/black.css" TITLE="Black">
         <!--
         <!--

+ 2 - 1
vnc_auto.html

@@ -8,7 +8,8 @@
         http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1
         http://example.com/?host=HOST&port=PORT&encrypt=1&true_color=1
     -->
     -->
     <head>
     <head>
-        <title>VNC Client</title>
+        <title>noVNC</title>
+        <meta http-equiv="X-UA-Compatible" content="chrome=1">
         <link rel="stylesheet" href="include/plain.css" title="plain">
         <link rel="stylesheet" href="include/plain.css" title="plain">
         <!--
         <!--
         <script type='text/javascript' 
         <script type='text/javascript'