Code

Updated browser detection-
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Jul 2008 10:16:24 +0000 (10:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Jul 2008 10:16:24 +0000 (10:16 +0000)
Opera caused undefined browserType attribute. -> Dialogs couldn't be closed.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11522 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/html/include/focus.js

index 796798fb486f9b8dc15b4d5d69b765f661b02d47..843a0a123b419fbb006becf2c5b919a505368ab6 100644 (file)
@@ -1,11 +1,32 @@
-var browserType;
+var browserType = "Not dectected, adjust focus.js";
 var firefoxType;
 
-if (document.layers) {browserType = "nn4"}
-if (document.all) {browserType = "ie"}
-if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
-if (browserType=="gecko" && window.navigator.userAgent.toLowerCase().match("firefox\/2")) {firefoxType= "firefox2"}
-else {firefoxType= "firefox"};
+if (document.layers) 
+{
+               browserType = "nn4";
+}
+
+if (document.all) 
+{
+               browserType = "ie";
+}
+
+if (window.navigator.userAgent.toLowerCase().match("gecko")) 
+{
+               browserType= "gecko";
+}
+
+if (window.navigator.userAgent.toLowerCase().match(/opera/i)) 
+{
+               browserType= "gecko";
+}
+
+if (browserType=="gecko" && window.navigator.userAgent.toLowerCase().match("firefox\/2")) 
+{
+               firefoxType= "firefox2";
+}else{
+               firefoxType= "firefox";
+}
 
 netscape = "";
 ver= navigator.appVersion; len = ver.length;