From 78ee04fa376578048a13694d4af04bd0cf39bdd0 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Mon, 9 May 2016 09:44:04 +0300 Subject: [PATCH] fix Android tablet detection fix #136 --- src/bowser.js | 19 +++++++++++++++++-- src/useragents.js | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/bowser.js b/src/bowser.js index 2911fe3..50ed7ce 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -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 } diff --git a/src/useragents.js b/src/useragents.js index 9b56e38..bc119af 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -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': {