changeset 425:fd8bef319208

browserCheck
author abukhman
date Wed, 12 Jan 2011 15:10:45 +0100
parents 6646227c281e
children a935129e169f
files documentViewer.py
diffstat 1 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Tue Jan 11 11:55:37 2011 +0100
+++ b/documentViewer.py	Wed Jan 12 15:10:45 2011 +0100
@@ -58,17 +58,51 @@
     bt['ua'] = ua
     bt['isIE'] = False
     bt['isN4'] = False
+    bt['versFirefox']=""
+    bt['versIE']=""
+    bt['versSafariChrome']=""
+    bt['versOpera']=""
+    
     if string.find(ua, 'MSIE') > -1:
         bt['isIE'] = True
     else:
         bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
-        
+    # Safari oder Chrome identification    
+    try:
+        nav = ua[string.find(ua, '('):]
+        nav1=ua[string.find(ua,')'):]
+        nav2=nav1[string.find(nav1,'('):]
+        nav3=nav2[string.find(nav2,')'):]
+        ie = string.split(nav, "; ")[1]
+        ie1 =string.split(nav1, " ")[2]
+        ie2 =string.split(nav3, " ")[1]
+        ie3 =string.split(nav3, " ")[2]
+        if string.find(ie3, "Safari") >-1:
+            bt['versSafariChrome']=string.split(ie2, "/")[1]
+    except: pass
+    # IE identification
     try:
         nav = ua[string.find(ua, '('):]
         ie = string.split(nav, "; ")[1]
         if string.find(ie, "MSIE") > -1:
             bt['versIE'] = string.split(ie, " ")[1]
-    except: pass
+    except:pass
+    # Firefox identification
+    try:
+        nav = ua[string.find(ua, '('):]
+        nav1=ua[string.find(ua,')'):]
+        if string.find(ie1, "Firefox") >-1:
+            nav5= string.split(ie1, "/")[1]
+            logging.debug("FIREFOX: %s"%(nav5))
+            bt['versFirefox']=string.split(nav5, ".")[1]                   
+    except:pass
+    #Opera identification
+    try:
+        if string.find(ua,"Opera") >-1:
+            nav = ua[string.find(ua, '('):]
+            nav1=nav[string.find(nav,')'):]
+            bt['versOpera']=string.split(nav1,"/")[2]
+    except:pass
     
     bt['isMac'] = string.find(ua, 'Macintosh') > -1
     bt['isWin'] = string.find(ua, 'Windows') > -1