diff --git a/package.json b/package.json index cb35af3..119a0ae 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "sgautrea ", "Shane Gautreau ", "Shane Thacker ", + "shchotse ", "Simon Eisenmann ", "Simon Lang ", "Stiekel ", diff --git a/readme.md b/readme.md index 33e639e..a3abd64 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # UAParser.js - A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not be more accurate than using feature detection. + A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~17KB when minified / ~6KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not be more accurate than using feature detection. [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![NPM downloads](https://img.shields.io/npm/dw/ua-parser-js.svg)](https://www.npmjs.com/package/ua-parser-js) @@ -27,15 +27,19 @@ ``` # Possible 'browser.name': -Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Bowser, Camino, Chimera, -Chrome [WebView], Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, -Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, -IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, -Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, -Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, QQBrowserLite, Quark, RockMelt, Silk, Skyfire, -SeaMonkey, Sleipnir, SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, Waterfox, -WeChat, Yandex +2345Explorer, Amaya, Android Browser, Arora, Avant, BIDUBrowser, Baidu, +Basilisk, Blazer, Bolt, Bowser, Camino, Chimera, Chrome Headless, +Chrome WebView, Chrome, Chromium, Comodo Dragon, Dillo, Dolphin, Doris, Edge, +Epiphany, Facebook, Fennec, Firebird, Firefox, Flock, GSA, GoBrowser, +ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceape, Iceweasel, +Iridium, Iron, Jasmine, K-Meleon, Kindle, Konqueror, LBBROWSER Line, Links, +Lunascape, Lynx, MIUI Browser, Maemo Browser, Maemo, Maxthon, MetaSr Midori, +Minimo, Mobile Safari, Mosaic, Mozilla, NetFront, NetSurf, Netfront, Netscape, +NokiaBrowser, Oculus Browser, OmniWeb, Opera Coast, Opera Mini, Opera Mobi, +Opera Tablet, Opera, PaleMoon, PhantomJS, Phoenix, Polaris, Puffin, QQ, +QQBrowser, QQBrowserLite, Quark, RockMelt, Safari, Samsung Browser, SeaMonkey, +Silk, Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, +Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m # 'browser.version' determined dynamically ``` diff --git a/src/ua-parser.js b/src/ua-parser.js index 3e8ede1..dd82835 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -280,6 +280,9 @@ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ + /(brave)\/([\w\.]+)/i // Brave browser + ], [[NAME, 'Brave'], VERSION], [ + /(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite ], [NAME, VERSION], [ @@ -681,6 +684,8 @@ ],[[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, TABLET]], [ /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ + /(mz)-([\w-]{2,})/i // Meizu Phone + ], [[VENDOR, 'Meizu'], MODEL, [TYPE, MOBILE]], [ /android.+a000(1)\s+build/i, // OnePlus /android.+oneplus\s(a\d{4})\s+build/i diff --git a/test/browser-test.json b/test/browser-test.json index 8deb980..fd3dd2e 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1051,7 +1051,7 @@ "expect" : { "name" : "BIDUBrowser", - "version" : "8.7", + "version" : "8.7", "major" : "8" } }, @@ -1074,5 +1074,15 @@ "version" : "1.1.0", "major" : "1" } + }, + { + "desc" : "Brave Browser", + "ua" : "Brave/4.5.16 CFNetwork/893.13.1 Darwin/17.3.0 (x86_64)", + "expect" : + { + "name" : "Brave", + "version" : "4.5.16", + "major" : "4" + } } ] diff --git a/test/device-test.json b/test/device-test.json index b8407f0..340ddb9 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -133,6 +133,26 @@ "type": "mobile" } }, + { + "desc" : "Meizu M3S", + "ua" : "Mozilla/5.0 (X11; Linux; Android 5.1; MZ-M3s Build/LMY47I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrom/45.0.2454.94 Mobile Safari/537.36", + "expect" : + { + "vendor" : "Meizu", + "model" : "M3s", + "type" : "mobile" + } + }, + { + "desc" : "Microsoft Lumia 950", + "ua" : "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586", + "expect" : + { + "vendor" : "Microsoft", + "model" : "Lumia 950", + "type" : "mobile" + } + }, { "desc": "Motorola Nexus 6", "ua": "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.20 Mobile Safari/537.36",