]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Better browser OS detection.
authorJesper Dam <jalf@medical-insight.com>
Wed, 12 Mar 2014 10:11:52 +0000 (11:11 +0100)
committerJesper Dam <jalf@medical-insight.com>
Wed, 12 Mar 2014 10:19:57 +0000 (11:19 +0100)
Apparently Firefox on Linux changed the value of navigator.appVersion,
causing our OS detection (used to determine how to interpret different
modifier keys) to fail.

Use navigator.platform instead, which should be more stable.

http://stackoverflow.com/a/19883965/33213

include/keyboard.js

index 3fde55bb08b2c577c33b213bf50fdf6db6e55fcd..6bea9b532f38fe51ebd7dbe2fc4002d13ae133b7 100644 (file)
@@ -18,13 +18,13 @@ var kbdUtil = (function() {
     };
 
     function isMac() {
-        return navigator && !!(/macintosh/i).exec(navigator.appVersion);
+        return navigator && !!(/mac/i).exec(navigator.platform);
     }
     function isWindows() {
-        return navigator && !!(/windows/i).exec(navigator.appVersion);
+        return navigator && !!(/win/i).exec(navigator.platform);
     }
     function isLinux() {
-        return navigator && !!(/linux/i).exec(navigator.appVersion);
+        return navigator && !!(/linux/i).exec(navigator.platform);
     }
 
     // Return true if a modifier which is not the specified char modifier (and is not shift) is down