matthewhudson / current-device

📱 The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).
https://matthewhudson.github.io/current-device/
MIT License
3.95k stars 586 forks source link

Lots of android device recognized as blackberry #202

Closed girvan closed 3 years ago

girvan commented 5 years ago
device.blackberry = function() {
  return find('blackberry') || find('bb10') || find('rim')
}

Since rim is very easy to conflict with some words, e.g. prime, primary, primo. Some open source suggest to match rim[0-9], but I search my access log over 10M+, but not found. I suggest to remove find('rim') to avoid miss-recognized.

Here are some user agents with rim, but it's not blackberry device

Mozilla/5.0 (Linux; Android 7.1.2; Redmi Note 5A Prime Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 [FB_IAB/Orca-Android;FBAV/213.1.0.17.114;]
Mozilla/5.0 (Linux; Android 7.1.2; View Prime) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.136 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 8.1.0; Mi Max Prime Build/OPM8.181005.003) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.109 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 8.1.0; SM-J415F Build/M1AJQ; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Instagram 91.0.0.18.118 Android (27/8.1.0; 320dpi; 720x1384; samsung; SM-J415F; j4primelte; qcom; ar_AE; 152367502)
Mozilla/5.0 (Linux; U; Android 6.0; en-US; Primo H6 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.9.0.1141 Mobile Safari/537.36
Mozilla/5.0 (Linux; U; Android 7.1.2; id-id; Redmi Note 5A Prime Build/N2G47H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.7.1-g
Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.6.4.950 UWS/2.11.1.50 Mobile Safari/537.36 AliApp(DingTalk/4.5.8) com.alibaba.android.rimet/10380049 Channel/227200 language/zh-CN
Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; STF-AL10 Build/HUAWEISTF-AL10) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/11.9.4.974 UWS/2.13.1.52 Mobile Safari/537.36 AliApp(DingTalk/4.6.25) com.alibaba.android.rimet/11281457 Channel/227200 language/zh-CN
matthewhudson commented 5 years ago

Great catch, thank you @girvan!

matthewhudson commented 3 years ago

Fixed in latest release.