1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Detect chrome book user agent.

This commit is contained in:
hsteinbr 2015-06-04 13:53:50 -07:00
parent 7ff16b172d
commit 38f79cf152
2 changed files with 10 additions and 2 deletions

View File

@ -24,6 +24,7 @@
var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
, likeAndroid = /like android/i.test(ua) , likeAndroid = /like android/i.test(ua)
, android = !likeAndroid && /android/i.test(ua) , android = !likeAndroid && /android/i.test(ua)
, chromeBook = /CrOS/.test(ua)
, edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) , edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i)
, versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
, tablet = /tablet/i.test(ua) , tablet = /tablet/i.test(ua)
@ -64,8 +65,14 @@
, msie: t , msie: t
, version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
} }
} } else if (chromeBook) {
else if (/chrome.+? edge/i.test(ua)) { result = {
name: 'Chrome'
, chromeBook: t
, chrome: t
, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
}
} else if (/chrome.+? edge/i.test(ua)) {
result = { result = {
name: 'Microsoft Edge' name: 'Microsoft Edge'
, msedge: t , msedge: t

View File

@ -86,6 +86,7 @@ module.exports.useragents = {
} }
, 'Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36': { , 'Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36': {
chrome: true chrome: true
, chromeBook: true
, version: '29.0' , version: '29.0'
, webkit: true , webkit: true
, a: true , a: true