Added basic browser detection for Chrome
authorAlexander Ebert <ebert@woltlab.com>
Mon, 11 Feb 2013 23:04:03 +0000 (00:04 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 11 Feb 2013 23:04:03 +0000 (00:04 +0100)
wcfsetup/install/files/js/WCF.js

index dcf6581cd11ffba37b31af10c9fb569ff9803ba3..bff2bf2953cc8ef0f0e6ce47db6464b4085e6dd8 100755 (executable)
@@ -546,6 +546,33 @@ $.extend(WCF, {
        }
 });
 
+/**
+ * Browser related functions.
+ */
+WCF.Browser = {
+       /**
+        * determines if browser is chrome
+        * @var boolean
+        */
+       _isChrome: null,
+       
+       /**
+        * Returns true, if browser is Chrome, Chromium or using GoogleFrame for Internet Explorer.
+        * 
+        * @return      boolean
+        */
+       isChrome: function() {
+               if (this._isChrome === null) {
+                       this._isChrome = false;
+                       if (/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())) {
+                               this._isChrome = true;
+                       }
+               }
+               
+               return this._isChrome;
+       }
+};
+
 /**
  * Dropdown API
  */