Skip to content

Commit

Permalink
fix Android tablet detection
Browse files Browse the repository at this point in the history
fix #136
  • Loading branch information
lancedikson committed May 9, 2016
1 parent b9edb72 commit 78ee04f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/bowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,24 @@

// device type extraction
var osMajorVersion = osVersion.split('.')[0];
if (tablet || nexusTablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {
if (
tablet
|| nexusTablet
|| iosdevice == 'ipad'
|| (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
|| result.silk
) {
result.tablet = t
} else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || nexusMobile || result.blackberry || result.webos || result.bada) {
} else if (
mobile
|| iosdevice == 'iphone'
|| iosdevice == 'ipod'
|| android
|| nexusMobile
|| result.blackberry
|| result.webos
|| result.bada
) {
result.mobile = t
}

Expand Down
18 changes: 18 additions & 0 deletions src/useragents.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ module.exports.useragents = {
, mobile: true
, a: true
}
, 'Mozilla/5.0 (Linux; Android 5.0.2; SM-T705 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.105 Safari/537.36': {
chrome: true
, android: true
, version: '49.0'
, osversion: '5.0.2'
, blink: true
, a: true
, tablet: true
}
, 'Mozilla/5.0 (Linux; Android 6.0.99; Build/NPC91K) AppleWebKit/537.36(KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36': {
chrome: true
, android: true
, tablet: true
, osversion: '6.0.99'
, version: '50.0'
, blink: true
, a: true
}
}
, 'Amazon Silk': {
'Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true': {
Expand Down

0 comments on commit 78ee04f

Please sign in to comment.