瀏覽代碼

Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).

Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
samhed 11 年之前
父節點
當前提交
60a415ae1c
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      include/keyboard.js

+ 4 - 1
include/keyboard.js

@@ -173,7 +173,10 @@ var kbdUtil = (function() {
         else if (evt.charCode) {
             codepoint = evt.charCode;
         }
-
+        else if (evt.keyCode && evt.type === 'keypress') {
+            // IE10 stores the char code as keyCode, and has no other useful properties
+            codepoint = evt.keyCode;
+        }
         if (codepoint) {
             var res = keysyms.fromUnicode(substituteCodepoint(codepoint));
             if (res) {