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

Correct Microsoft Edge' detection on iOS and Android

This commit is contained in:
everget 2017-10-18 22:04:52 +03:00
parent 6c71fe2c38
commit 0cc6063ec8
2 changed files with 23 additions and 4 deletions

View File

@ -42,7 +42,7 @@
, windows = !windowsphone && /windows/i.test(ua) , windows = !windowsphone && /windows/i.test(ua)
, mac = !iosdevice && !silk && /macintosh/i.test(ua) , mac = !iosdevice && !silk && /macintosh/i.test(ua)
, linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
, edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
, versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
, tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua) , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
, mobile = !tablet && /[^-]mobi/i.test(ua) , mobile = !tablet && /[^-]mobi/i.test(ua)
@ -157,7 +157,7 @@
, chrome: t , chrome: t
, version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
} }
} else if (/chrome.+? edge/i.test(ua)) { } else if (/edg([ea]|ios)/i.test(ua)) {
result = { result = {
name: 'Microsoft Edge' name: 'Microsoft Edge'
, msedge: t , msedge: t
@ -329,10 +329,10 @@
} }
// set OS flags for platforms that have multiple browsers // set OS flags for platforms that have multiple browsers
if (!result.windowsphone && !result.msedge && (android || result.silk)) { if (!result.windowsphone && (android || result.silk)) {
result.android = t result.android = t
result.osname = 'Android' result.osname = 'Android'
} else if (!result.windowsphone && !result.msedge && iosdevice) { } else if (!result.windowsphone && iosdevice) {
result[iosdevice] = t result[iosdevice] = t
result.ios = t result.ios = t
result.osname = 'iOS' result.osname = 'iOS'

View File

@ -816,6 +816,25 @@ module.exports.useragents = {
, osversion: '10' , osversion: '10'
, a: true , a: true
} }
, 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Mobile/14F89 Safari/603.2.4 EdgiOS/41.1.35.1': {
osname: 'iOS'
, msedge: true
, version: '41.1'
, ios: true
, iphone: true
, mobile: true
, osversion: '10.3.2'
, a: true
}
, 'Mozilla/5.0 (Linux; Android 8.0; Pixel XL Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.0 Mobile Safari/537.36 EdgA/41.1.35.1': {
osname: 'Android'
, msedge: true
, version: '41.1'
, android: true
, mobile: true
, osversion: '8.0'
, a: true
}
} }
, Firefox: { , Firefox: {
'Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0': { 'Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0': {