From fa6eb05380b3b49b1aae02d2e2168406703eaca6 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Mon, 23 Apr 2012 03:44:37 +0200 Subject: [PATCH] detect Chrome for Android --- include/classes/useragent.php-class | 5 +++++ testbed/ua_list_raw.txt | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/classes/useragent.php-class b/include/classes/useragent.php-class index 6363e9f..0512f69 100755 --- a/include/classes/useragent.php-class +++ b/include/classes/useragent.php-class @@ -1240,6 +1240,11 @@ class userAgent { $this->uadata['os'] = $regs[1]; $this->uadata['lang'] = $regs[2]; } + elseif (preg_match('|Mozilla/5.0 \(Linux; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) { + // (Chrome for) Android - $regs[2] is device + $this->uadata['os'] = $regs[1]; + $this->uadata['lang'] = null; + } elseif (preg_match('|Mozilla/5.0 \(([^\);]+); ([^\);]+)\)|', $this->uastring, $regs)) { if (($regs[1] == 'X11') || ($regs[1] == 'Macintosh') || ($regs[1] == 'iPhone')) { $this->uadata['os'] = $regs[2]; diff --git a/testbed/ua_list_raw.txt b/testbed/ua_list_raw.txt index 63ecf7c..ca3a526 100755 --- a/testbed/ua_list_raw.txt +++ b/testbed/ua_list_raw.txt @@ -191,6 +191,8 @@ Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.109 Safari/535.1 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.51 (KHTML, like Gecko; Google Web Preview) Chrome/12.0.742 Safari/534.51 +Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19 +Mozilla/5.0 (Linux; Android 4.0.3; Transformer TF 101 Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Safari/535.19 Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/21.0.025; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE63-3/100.21.110; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 -- 2.35.3