mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-16 23:21:52 +03:00
Compare commits
220 Commits
0.7.25
...
2.0.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d2acd8fe7 | ||
|
|
359cbecd32 | ||
|
|
1e80cf3533 | ||
|
|
b09878934f | ||
|
|
30de983043 | ||
|
|
894512c72f | ||
|
|
4af26c7a5e | ||
|
|
a6c85d0148 | ||
|
|
7a4fe6f454 | ||
|
|
af65fd6960 | ||
|
|
ba28d33d51 | ||
|
|
82567c28ab | ||
|
|
e70d09a1f8 | ||
|
|
3af8e1e272 | ||
|
|
172f57ffea | ||
|
|
33f02099d1 | ||
|
|
33df5dc698 | ||
|
|
49d6422ebd | ||
|
|
a1d816ae21 | ||
|
|
0097b211db | ||
|
|
6b3fc3e0f1 | ||
|
|
08436ce4f5 | ||
|
|
df1a1c7bb4 | ||
|
|
31f94f3a51 | ||
|
|
6821276669 | ||
|
|
41f8d76968 | ||
|
|
c78346d3b4 | ||
|
|
f8dde65d54 | ||
|
|
60d3a2fbbc | ||
|
|
aff5a209f8 | ||
|
|
5672a2e15c | ||
|
|
3c3c03ceeb | ||
|
|
d99ff741f4 | ||
|
|
9ee128ae2b | ||
|
|
c6b4c867d5 | ||
|
|
f1449a8202 | ||
|
|
18730452f2 | ||
|
|
5ea9f0ec16 | ||
|
|
03b0a5afa6 | ||
|
|
d03c74d6b7 | ||
|
|
f18516c9c8 | ||
|
|
746ac28f94 | ||
|
|
96fb3a5ed5 | ||
|
|
6c34c3d4fa | ||
|
|
f8e5a1fb4f | ||
|
|
c9d1ab9561 | ||
|
|
f815ca6e9c | ||
|
|
0cbeb7a829 | ||
|
|
bf4fb916ca | ||
|
|
68447d883a | ||
|
|
0b0c7ff617 | ||
|
|
5b2e80bdfd | ||
|
|
ba0f25c19d | ||
|
|
4d3048aaaa | ||
|
|
97e4a89685 | ||
|
|
1a521b867f | ||
|
|
5d4ca2b4c2 | ||
|
|
cf093222e5 | ||
|
|
f2d0db001d | ||
|
|
a6140a17dd | ||
|
|
2033eb4aba | ||
|
|
a886604935 | ||
|
|
b814bcd791 | ||
|
|
df7551c9b6 | ||
|
|
94f2d604d1 | ||
|
|
e5942dc505 | ||
|
|
4ef9841592 | ||
|
|
528e7aea1c | ||
|
|
5e33df3b6b | ||
|
|
a8a4e71345 | ||
|
|
1f6a7e2860 | ||
|
|
db5567d614 | ||
|
|
2f7017b4d5 | ||
|
|
8ffdf232f4 | ||
|
|
98096f1454 | ||
|
|
5fd47ee00d | ||
|
|
6fde0d92d6 | ||
|
|
7f71024161 | ||
|
|
c239ac5167 | ||
|
|
8d3c2d327c | ||
|
|
d11fc47dc9 | ||
|
|
b490110109 | ||
|
|
cb5da5ea4b | ||
|
|
b2d685dd9c | ||
|
|
8d21e34201 | ||
|
|
48d930f0f1 | ||
|
|
55b5b40c7d | ||
|
|
d141915d45 | ||
|
|
8483ac09b3 | ||
|
|
896bdd04e4 | ||
|
|
25fff62540 | ||
|
|
ea04d018bb | ||
|
|
29b613deee | ||
|
|
238391a977 | ||
|
|
384f780a70 | ||
|
|
75e58525fe | ||
|
|
ebb32d1ad9 | ||
|
|
dea39e1693 | ||
|
|
ca417e25a9 | ||
|
|
f54d3fadac | ||
|
|
21fe76742f | ||
|
|
30ac448a0c | ||
|
|
1e82d7d265 | ||
|
|
a5cdc2975b | ||
|
|
180846b80a | ||
|
|
061a7a6145 | ||
|
|
ebebf0acb3 | ||
|
|
15ae12b71d | ||
|
|
4f77fbb441 | ||
|
|
cd25bc1866 | ||
|
|
534ba7dd7c | ||
|
|
0b423078c8 | ||
|
|
779b5dc1e5 | ||
|
|
18a4e5ade2 | ||
|
|
534d577355 | ||
|
|
fe963b58e5 | ||
|
|
6e39c8a553 | ||
|
|
3d4ec6ef3b | ||
|
|
f02a431000 | ||
|
|
b6bddd8c09 | ||
|
|
a29213960c | ||
|
|
f761a89ab2 | ||
|
|
7ddb2575bd | ||
|
|
23ad60ea68 | ||
|
|
97f3368ef0 | ||
|
|
b86860e850 | ||
|
|
157af1e2f2 | ||
|
|
b4cfe1b624 | ||
|
|
95fea1cb26 | ||
|
|
30648cef1d | ||
|
|
10c978eca5 | ||
|
|
fbd2c6853c | ||
|
|
29d5e43342 | ||
|
|
051aa5d284 | ||
|
|
139fbc321a | ||
|
|
191fed9127 | ||
|
|
8fe448fddf | ||
|
|
343d584f8f | ||
|
|
ef54fd35d6 | ||
|
|
79535f5d61 | ||
|
|
ee743946e8 | ||
|
|
f57bd9523d | ||
|
|
ffc03acd64 | ||
|
|
62cc99d7cf | ||
|
|
b542df155a | ||
|
|
15aa73de40 | ||
|
|
336ce2b950 | ||
|
|
20a428c351 | ||
|
|
47c310e203 | ||
|
|
825edbbf91 | ||
|
|
299283c436 | ||
|
|
39e8d4af03 | ||
|
|
03c915277a | ||
|
|
1e7b6d2e8b | ||
|
|
e5e13adc81 | ||
|
|
837042a3e8 | ||
|
|
7b3aa9fc15 | ||
|
|
8e55e00177 | ||
|
|
ca644313d6 | ||
|
|
ca83d4c9c3 | ||
|
|
9bed2b1437 | ||
|
|
3792900410 | ||
|
|
c05e4e837f | ||
|
|
c53a2a1f72 | ||
|
|
559ecaacb6 | ||
|
|
f715023f47 | ||
|
|
36b2275add | ||
|
|
75620c7b6c | ||
|
|
1d3c98a10c | ||
|
|
c39590b673 | ||
|
|
9200e53787 | ||
|
|
6c671dd246 | ||
|
|
535f11bd24 | ||
|
|
642c0399e8 | ||
|
|
3edacddb24 | ||
|
|
acc0b91ff5 | ||
|
|
f726dcd1ae | ||
|
|
383ca587ef | ||
|
|
7c8aa435b2 | ||
|
|
09aa9105dc | ||
|
|
557cc2198d | ||
|
|
f95aced43b | ||
|
|
24950f97ae | ||
|
|
cb30756f48 | ||
|
|
0868e372e0 | ||
|
|
9d431cfddd | ||
|
|
c937400e8e | ||
|
|
8bea5c552a | ||
|
|
3843578de9 | ||
|
|
be9a066029 | ||
|
|
6f2ba7fcd5 | ||
|
|
d72de26ef9 | ||
|
|
80fae81eee | ||
|
|
91fa6dd5cc | ||
|
|
a6b0c165c4 | ||
|
|
999764cf36 | ||
|
|
0e70fc4044 | ||
|
|
3b703a6379 | ||
|
|
4f27489ccf | ||
|
|
2cfd792d24 | ||
|
|
b406b5df2c | ||
|
|
536b9e8d9d | ||
|
|
8d5685771d | ||
|
|
69a568ae49 | ||
|
|
59d947dcab | ||
|
|
62cb5a2e54 | ||
|
|
cd61aef07d | ||
|
|
afe62e915d | ||
|
|
ef4eeadcd8 | ||
|
|
a0b40be04f | ||
|
|
73fb12b379 | ||
|
|
94d3550844 | ||
|
|
14e7dd3f86 | ||
|
|
dff9746527 | ||
|
|
effd766e3b | ||
|
|
c47f458586 | ||
|
|
8c2b84fc31 | ||
|
|
e1905168a8 | ||
|
|
fe5ca1de96 | ||
|
|
7fbb93c99a |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
github: faisalman
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: ua-parser-js
|
open_collective: ua-parser-js
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
|||||||
3
.github/workflows/run-test.yml
vendored
3
.github/workflows/run-test.yml
vendored
@@ -2,6 +2,9 @@ name: ua-parser-js-run-test
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-test:
|
run-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.7.25",
|
"version": "2.0.0-alpha.2",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Faisal Salman <f@faisalman.com>"
|
"Faisal Salman <f@faisalman.com>"
|
||||||
],
|
],
|
||||||
|
|||||||
89
changelog.md
Normal file
89
changelog.md
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# UAParser.js Changelog
|
||||||
|
|
||||||
|
# Version 2.0
|
||||||
|
- What's breaking:
|
||||||
|
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
|
||||||
|
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
|
||||||
|
- What's new:
|
||||||
|
- Add some new methods in result object:
|
||||||
|
- Add support for client hints: `withClientHints()`
|
||||||
|
- Utility for easy comparison: `is()`
|
||||||
|
- Utility to print full-name: `toString()`
|
||||||
|
- Add support for ES module `import { UAParser } from 'ua-parser-js'`
|
||||||
|
- Provide Enums `'ua-parser-js/enums'`
|
||||||
|
- Provide Extensions `'ua-parser-js/extensions'`
|
||||||
|
|
||||||
|
## Version 2.0.0-alpha.2
|
||||||
|
- Fix browser result always returning Chromium when using `withClientHints()`
|
||||||
|
- Fix infinite-loop when await-ing `withClientHints()` in non-client-hints browser
|
||||||
|
|
||||||
|
## Version 2.0.0-alpha.1
|
||||||
|
- Initial work on new major version
|
||||||
|
|
||||||
|
|
||||||
|
# Version 0.7 / 1.0
|
||||||
|
|
||||||
|
Version 1.0.x is basically the equivalent of version 0.7.x. See [#536](https://github.com/faisalman/ua-parser-js/issues/536) for the reason behind this confusion.
|
||||||
|
|
||||||
|
## Version 0.7.35 / 1.0.35
|
||||||
|
- Fix result from user-supplied user-agent being altered
|
||||||
|
- Add new browser: Heytap, TikTok
|
||||||
|
- Add new engine: LibWeb
|
||||||
|
- Add new OS: SerenityOS
|
||||||
|
- Improve browser detection: Yandex
|
||||||
|
- Improve device detection: iPhone, Amazon Echo
|
||||||
|
- Improve OS detection: iOS
|
||||||
|
|
||||||
|
## Version 0.7.34 / 1.0.34
|
||||||
|
- Fix Sharp Mobile detected as Huawei Tablet
|
||||||
|
- Fix IE8 bug
|
||||||
|
- Add new devices : Kobo e-Reader, Apple Watch, and some new SmartTV devices
|
||||||
|
- Add new OS : watchOS
|
||||||
|
- Improve browser detection : Kakao, Naver, Brave
|
||||||
|
- Improve device detection : Oculus, iPad
|
||||||
|
- Improve OS detection : Chrome OS
|
||||||
|
- Using navigator.userAgentData as fallback for device.type & os.name
|
||||||
|
|
||||||
|
## Version 0.7.33 / 1.0.33
|
||||||
|
|
||||||
|
- Add new browser : Cobalt
|
||||||
|
- Identify Macintosh as an Apple device
|
||||||
|
- Fix ReDoS vulnerability
|
||||||
|
|
||||||
|
## Version 0.7.32 / 1.0.32
|
||||||
|
|
||||||
|
- Add new browser : DuckDuckGo, Huawei Browser, LinkedIn
|
||||||
|
- Add new OS : HarmonyOS
|
||||||
|
- Add some Huawei models
|
||||||
|
- Add Sharp Aquos TV
|
||||||
|
- Improve detection Xiaomi Mi CC9
|
||||||
|
- Fix Sony Xperia 1 III misidentified as Acer tablet
|
||||||
|
- Fix Detect Sony BRAVIA as SmartTV
|
||||||
|
- Fix Detect Xiaomi Mi TV as SmartTV
|
||||||
|
- Fix Detect Galaxy Tab S8 as tablet
|
||||||
|
- Fix WeGame mistakenly identified as WeChat
|
||||||
|
- Fix included commas in Safari / Mobile Safari version
|
||||||
|
- Increase UA_MAX_LENGTH to 350
|
||||||
|
|
||||||
|
## Version 0.7.31 / 1.0.2
|
||||||
|
|
||||||
|
- Fix OPPO Reno A5 incorrect detection
|
||||||
|
- Fix TypeError Bug
|
||||||
|
- Use AST to extract regexes and verify them with safe-regex
|
||||||
|
|
||||||
|
## Version 0.7.30 / 1.0.1
|
||||||
|
|
||||||
|
- Add new browser : Obigo, UP.Browser, Klar
|
||||||
|
- Add new device : Oculus, Roku
|
||||||
|
- Add new OS: Maemo, HP-UX, Android-x86, Deepin, elementary OS, GhostBSD, Linspire, Manjaro, Sabayon
|
||||||
|
- Improve detection for Sony Xperia 1ii, LG Android TV, and some more devices
|
||||||
|
- Improve detection for ARM64 CPU
|
||||||
|
- Improve detection for Windows Mobile, Netscape, Mac on PowerPC
|
||||||
|
- Categorize PDA as mobile
|
||||||
|
- Fix Sharp devices misjudged as Huawei
|
||||||
|
- Fix trailing comma for ES3 compatibility
|
||||||
|
- Some code refactor
|
||||||
|
|
||||||
|
# Version 0.8
|
||||||
|
|
||||||
|
Version 0.8 was created by accident. This version is now deprecated and no longer maintained, please update to version 0.7 / 1.0.
|
||||||
13
dist/ua-parser.min.js
vendored
13
dist/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
13
dist/ua-parser.pack.js
vendored
13
dist/ua-parser.pack.js
vendored
File diff suppressed because one or more lines are too long
19
images/51degrees.svg
Normal file
19
images/51degrees.svg
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 23.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 161.93 86.82" style="enable-background:new 0 0 161.93 86.82;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#232628;}
|
||||||
|
.st1{fill:#E62E3A;}
|
||||||
|
.st2{fill:none;}
|
||||||
|
</style>
|
||||||
|
<g>
|
||||||
|
<path class="st0" d="M116.93,0.68H103.5V17.5h13.43c15.24,0,25.53,10.53,25.53,25.53v0.24c0,15-10.28,25.29-25.53,25.29H103.5
|
||||||
|
v16.82h13.43c26.62,0,45-18.51,45-42.34v-0.24C161.93,18.95,143.54,0.68,116.93,0.68"/>
|
||||||
|
<path class="st1" d="M8.11,0.68h52.02v16.33H24.07l-0.97,14.64c3.39-0.85,6.41-1.45,11.13-1.45c16.7,0,29.64,7.99,29.64,27.22
|
||||||
|
c0,18.03-12.7,29.4-32.18,29.4c-13.55,0-23.47-4.84-31.7-12.7l11.25-13.43c6.41,5.81,12.7,9.19,20.2,9.19
|
||||||
|
c8.71,0,14.15-4.23,14.15-11.86c0-7.38-5.93-11.61-15-11.61c-5.32,0-10.16,1.45-14.16,3.15L5.69,42.42L8.11,0.68z"/>
|
||||||
|
<polygon class="st1" points="86.14,0 98.84,0 98.84,85.29 80.45,85.29 80.45,18.87 65.69,22.5 61.82,7.26 "/>
|
||||||
|
</g>
|
||||||
|
<rect x="144.06" y="110.12" class="st2" width="566.93" height="113.39"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2012-2021 Faisal Salman <<f@faisalman.com>>
|
Copyright (c) 2012-2023 Faisal Salman <<f@faisalman.com>>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Package.describe({
|
Package.describe({
|
||||||
name: 'faisalman:ua-parser-js',
|
name: 'faisalman:ua-parser-js',
|
||||||
version: '0.7.25',
|
version: '2.0.0-alpha.2',
|
||||||
summary: 'Lightweight JavaScript-based user-agent string parser',
|
summary: 'Lightweight JavaScript-based user-agent string parser',
|
||||||
git: 'https://github.com/faisalman/ua-parser-js.git',
|
git: 'https://github.com/faisalman/ua-parser-js.git',
|
||||||
documentation: 'readme.md'
|
documentation: 'readme.md'
|
||||||
|
|||||||
94
package.json
94
package.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.7.25",
|
"version": "2.0.0-alpha.2",
|
||||||
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
|
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"user-agent",
|
"user-agent",
|
||||||
"parser",
|
"parser",
|
||||||
@@ -20,88 +20,151 @@
|
|||||||
"Aamir Poonawalla <aamir@urx.com>",
|
"Aamir Poonawalla <aamir@urx.com>",
|
||||||
"Admas <mollases@users.noreply.github.com>",
|
"Admas <mollases@users.noreply.github.com>",
|
||||||
"algenon <m@antonz.ru>",
|
"algenon <m@antonz.ru>",
|
||||||
"Alvin Portillo <portilloalvin@gmail.com>",
|
"Alvin Portillo <alvin@8thwall.com>",
|
||||||
|
"Amumu <yoyo837@hotmail.com>",
|
||||||
"Andrea Vaghi <andrea.vaghi@jobrapido.com>",
|
"Andrea Vaghi <andrea.vaghi@jobrapido.com>",
|
||||||
"Anton Zhiyanov <m@antonz.ru>",
|
"Anton Zhiyanov <m@antonz.ru>",
|
||||||
"Arturo Mejia <amejia@blim.com>",
|
"Arturo Mejia <amejia@blim.com>",
|
||||||
"Arun Rama Reddy <arunramareddy@gmail.com>",
|
"Arun Rama Reddy <arunramareddy@gmail.com>",
|
||||||
"Austin Pray <austin@austinpray.com>",
|
"Austin Pray <austin@austinpray.com>",
|
||||||
|
"Bendeguz <symunona@gmail.com>",
|
||||||
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
||||||
"Benjamin Urban <benjamin.urban@sueddeutsche.de>",
|
"Benjamin Urban <benjamin.urban@sueddeutsche.de>",
|
||||||
"boneyao <admin@boneyao.com>",
|
"boneyao <admin@boneyao.com>",
|
||||||
"Carl C Von Lewin <carlchristianlewin@gmail.com>",
|
"Carl C Von Lewin <carlchristianlewin@gmail.com>",
|
||||||
"CESAR RAMOS <c@imagenproactiva.com>",
|
"CESAR RAMOS <c@imagenproactiva.com>",
|
||||||
|
"Chad Killingsworth <ckillingsworth@jackhenry.com>",
|
||||||
"Christopher De Cairos <chris.decairos@gmail.com>",
|
"Christopher De Cairos <chris.decairos@gmail.com>",
|
||||||
|
"Cyrille David <cyrille@qonto.eu>",
|
||||||
"Dario Vladovic <d.vladimyr@gmail.com>",
|
"Dario Vladovic <d.vladimyr@gmail.com>",
|
||||||
|
"David Annez <david.annez@gmail.com>",
|
||||||
"Davit Barbakadze <jayarjo@gmail.com>",
|
"Davit Barbakadze <jayarjo@gmail.com>",
|
||||||
"ddivernois <david-emmanuel.divernois@amadeus.com>",
|
"ddivernois <david-emmanuel.divernois@amadeus.com>",
|
||||||
|
"Deliaz <D3liaz@gmail.com>",
|
||||||
"Demis Palma <demis.palma@gmail.com>",
|
"Demis Palma <demis.palma@gmail.com>",
|
||||||
"dhoko <aurelien@protonmail.com>",
|
"dhoko <aurelien@protonmail.com>",
|
||||||
"dianhe <dianhe@webank.com>",
|
"dianhe <dianhe@webank.com>",
|
||||||
|
"dineshks1 <dineshks1@d.kumar44@outlook.com>",
|
||||||
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
||||||
"Douglas Li <doug@knotch.it>",
|
"Douglas Li <doug@knotch.it>",
|
||||||
"Dumitru Uzun <contact@duzun.me>",
|
"Dumitru Uzun <contact@duzun.me>",
|
||||||
|
"Dustin <duburns@fanatics.com>",
|
||||||
|
"Elchin Valiyev <elchin.valiyev@autodesk.com>",
|
||||||
|
"Emil Hesslow <hesslow@gmail.com>",
|
||||||
|
"Eric Redon <eric.redon@coox.org>",
|
||||||
"Eric Schrenker <eric.schrenker@gmail.com>",
|
"Eric Schrenker <eric.schrenker@gmail.com>",
|
||||||
"Erik Hesselink <hesselink@gmail.com>",
|
"Erik Hesselink <hesselink@gmail.com>",
|
||||||
"Fabian Becker <halfdan@xnorfz.de>",
|
"Fabian Becker <halfdan@xnorfz.de>",
|
||||||
"Faisal Salman <fyzlman@gmail.com>",
|
"Faisal Salman <f@faisalman.com>",
|
||||||
"Frédéric Camblor <fcamblor@gmail.com>",
|
"Frédéric Camblor <fcamblor@gmail.com>",
|
||||||
|
"Frederik Ring <frederik.ring@gmail.com>",
|
||||||
|
"Gerald Host <me@jacobford.co.uk>",
|
||||||
"Germán M. Bravo <german.mb@gmail.com>",
|
"Germán M. Bravo <german.mb@gmail.com>",
|
||||||
"Grigory Dmitrenko <grigory@snsk.ru>",
|
"Grigory Dmitrenko <grigory@snsk.ru>",
|
||||||
|
"gulpin <gulping.gulpin@gmail.com>",
|
||||||
"Hendrik Helwich <h.helwich@iplabs.de>",
|
"Hendrik Helwich <h.helwich@iplabs.de>",
|
||||||
"Hermann Ebert <ebbmo@HE.local>",
|
"Hermann Ebert <ebbmo@HE.local>",
|
||||||
|
"hr6r <hedian@gmail.com>",
|
||||||
|
"Igor Topal <i.topal@smartweb.com.ua>",
|
||||||
|
"Ildar Kamalov <i.kamalov@adguard.com>",
|
||||||
|
"insanehong <insane.hong@navercorp.com>",
|
||||||
"jackpoll <jackpoll123456@gmail.com>",
|
"jackpoll <jackpoll123456@gmail.com>",
|
||||||
"Jake Mc <startswithaj@users.noreply.github.com>",
|
"Jake Mc <startswithaj@users.noreply.github.com>",
|
||||||
|
"JBYoshi <12983479+JBYoshi@users.noreply.github.com>",
|
||||||
|
"Joey Parrish <joeyparrish@google.com>",
|
||||||
"John Tantalo <john.tantalo@gmail.com>",
|
"John Tantalo <john.tantalo@gmail.com>",
|
||||||
"John Yanarella <jmy@codecatalyst.com>",
|
"John Yanarella <jmy@codecatalyst.com>",
|
||||||
"Jon Buckley <jon@jbuckley.ca>",
|
"Jon Buckley <jon@jbuckley.ca>",
|
||||||
|
"Josh Goldberg <joshuakgoldberg@outlook.com>",
|
||||||
|
"Junki-Ishida <junki_ishida@dwango.co.jp>",
|
||||||
"Kendall Buchanan <kendall@kendagriff.com>",
|
"Kendall Buchanan <kendall@kendagriff.com>",
|
||||||
"Lee Treveil <leetreveil@gmail.com>",
|
"Lee Treveil <leetreveil@gmail.com>",
|
||||||
"leonardo <leofiore@libero.it>",
|
"leonardo <leofiore@libero.it>",
|
||||||
"Levente Balogh <balogh.levente.hu@gmail.com>",
|
"Levente Balogh <balogh.levente.hu@gmail.com>",
|
||||||
"Liam Quinn <lquinn@blackberry.com>",
|
"Liam Quinn <lquinn@blackberry.com>",
|
||||||
"Lithin <lithin@webklipper.com>",
|
"Lithin <lithin@webklipper.com>",
|
||||||
|
"ll-syber <670159357@qq.com>",
|
||||||
"Loris Guignard <loris.guignard@gmail.com>",
|
"Loris Guignard <loris.guignard@gmail.com>",
|
||||||
"Lukas Drgon <lukas.drgon@gmail.com>",
|
"Lukas Drgon <lukas.drgon@gmail.com>",
|
||||||
"Lukas Eipert <leipert@users.noreply.github.com>",
|
"Lukas Eipert <leipert@users.noreply.github.com>",
|
||||||
"Malash <i@malash.me>",
|
"Malash <i@malash.me>",
|
||||||
"Martynas <martynas@firmfirm.co>",
|
"Martynas <martynas@firmfirm.co>",
|
||||||
|
"Masahiko Sato <masasato@yahoo-corp.jp>",
|
||||||
"Matt Brophy <matt@brophy.org>",
|
"Matt Brophy <matt@brophy.org>",
|
||||||
"Max Maurer <maxemanuel.maurer@gmail.com>",
|
"Matthew Origer <karatecowboy@gmail.com>",
|
||||||
"Maximilian Haupt <mail@maximilianhaupt.com>",
|
"Maximilian Haupt <mail@maximilianhaupt.com>",
|
||||||
|
"Max Maurer <maxemanuel.maurer@gmail.com>",
|
||||||
|
"Max Nordlund <max.nordlund@gmail.com>",
|
||||||
"Michael Hess <mhess@connectify.me>",
|
"Michael Hess <mhess@connectify.me>",
|
||||||
|
"MimyyK <michele.marais@hakisa.com>",
|
||||||
"naoh <naoh.cs03g@nctu.edu.tw>",
|
"naoh <naoh.cs03g@nctu.edu.tw>",
|
||||||
|
"Nicholas Ionata <nionata@ufl.edu>",
|
||||||
|
"Nikhil Motiani <nikhil.motiani@outlook.com>",
|
||||||
"Nik Rolls <nik@rolls.cc>",
|
"Nik Rolls <nik@rolls.cc>",
|
||||||
"Nikhil Motiani <nikhil.m@247-inc.com>",
|
"nionata <n.ionata129@gmail.com>",
|
||||||
"niris <nirisix@gmail.com>",
|
"niris <nirisix@gmail.com>",
|
||||||
"Nobuo Okada <nookada@yahoo-corp.jp>",
|
"Nobuo Okada <nookada@yahoo-corp.jp>",
|
||||||
|
"o.drapeza <o.drapeza@tinkoff.ru>",
|
||||||
"otakuSiD <otakusid@gmail.com>",
|
"otakuSiD <otakusid@gmail.com>",
|
||||||
|
"patrick-nurt <github@pereira.dk>",
|
||||||
|
"Pavel Studeny <studeny@avast.com>",
|
||||||
"Peter Dave Hello <PeterDaveHello@users.noreply.github.com>",
|
"Peter Dave Hello <PeterDaveHello@users.noreply.github.com>",
|
||||||
"philippsimon <github@philippsimon.de>",
|
"philippsimon <github@philippsimon.de>",
|
||||||
"Pieter Hendrickx <pieter.hendrickx@belfius.be>",
|
"Pieter Hendrickx <pieter.hendrickx@belfius.be>",
|
||||||
"Piper Chester <piperchester@gmail.com>",
|
"Piper Chester <piperchester@gmail.com>",
|
||||||
|
"Queen Vinyl Darkscratch <vinyldarkscratch@gmail.com>",
|
||||||
|
"Raine Makelainen <raine.makelainen@jolla.com>",
|
||||||
|
"Raman Savaryn <homeneartheocean@gmail.com>",
|
||||||
"Robert Tod <robert@qubit.com>",
|
"Robert Tod <robert@qubit.com>",
|
||||||
|
"roman.savarin <roman.savarin@skywindgroup.com>",
|
||||||
"Ron Korland <ron@testim.io>",
|
"Ron Korland <ron@testim.io>",
|
||||||
"Ross Noble <rosshnoble@gmail.com>",
|
"Ross Noble <rosshnoble@gmail.com>",
|
||||||
|
"ruicong <466403866@qq.com>",
|
||||||
"Sandro Sonntag <sandro.sonntag@adorsys.de>",
|
"Sandro Sonntag <sandro.sonntag@adorsys.de>",
|
||||||
"sgautrea <shanegautreau@gmail.com>",
|
"sgautrea <shanegautreau@gmail.com>",
|
||||||
"Shane Gautreau <sgautrea@opentext.com>",
|
"Shane Gautreau <sgautrea@opentext.com>",
|
||||||
"Shane Thacker <shane@steadymade.com>",
|
"Shane Thacker <shane@steadymade.com>",
|
||||||
"shchotse <topal@mail.ua>",
|
"Shreedhar <shreedhar@uber.com>",
|
||||||
"Simon Eisenmann <simon@longsleep.org>",
|
"Simon Eisenmann <simon@longsleep.org>",
|
||||||
"Simon Lang <me@simonlang.org>",
|
"Simon Lang <me@simonlang.org>",
|
||||||
"Stiekel <histkc@gmail.com>",
|
"Stiekel <histkc@gmail.com>",
|
||||||
|
"sUP <dani3l@gmail.com>",
|
||||||
"Sylvain Gizard <sylvain.gizard@gmail.com>",
|
"Sylvain Gizard <sylvain.gizard@gmail.com>",
|
||||||
"szchenghuang <szchenghuang@gmail.com>",
|
"szchenghuang <szchenghuang@gmail.com>",
|
||||||
|
"Tanguy Krotoff <tkrotoff@gmail.com>",
|
||||||
|
"Tony Tomarchio <tony@tomarchio.cc>",
|
||||||
|
"Ulrich Schmidt <u.schmidt@velian.de>",
|
||||||
"Vadim Kurachevsky <vadim@hmvs.org>",
|
"Vadim Kurachevsky <vadim@hmvs.org>",
|
||||||
|
"Yılmaz <yilmazdemir36@gmail.com>",
|
||||||
|
"yuanyang <work_yuanyang@163.com>",
|
||||||
"Yun Young-jin <yupmin@yupmin-office-macmini.local>",
|
"Yun Young-jin <yupmin@yupmin-office-macmini.local>",
|
||||||
"Insanehong <insae.hong@navercorp.com>"
|
"Zach Bjornson <zbbjornson@gmail.com>"
|
||||||
],
|
],
|
||||||
|
"type": "commonjs",
|
||||||
"main": "src/ua-parser.js",
|
"main": "src/ua-parser.js",
|
||||||
|
"module": "src/ua-parser.mjs",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"require": "./src/ua-parser.js",
|
||||||
|
"import": "./src/ua-parser.mjs"
|
||||||
|
},
|
||||||
|
"./enums": {
|
||||||
|
"require": "./src/enum/ua-parser-enum.js",
|
||||||
|
"import": "./src/enum/ua-parser-enum.mjs"
|
||||||
|
},
|
||||||
|
"./extensions": {
|
||||||
|
"require": "./src/extension/ua-parser-extension.js",
|
||||||
|
"import": "./src/extension/ua-parser-extension.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "uglifyjs src/ua-parser.js -o dist/ua-parser.min.js --comments && uglifyjs src/ua-parser.js -o dist/ua-parser.pack.js --comments --compress --mangle",
|
"build": "uglifyjs src/ua-parser.js -o dist/ua-parser.min.js --comments '/^ UA/' && uglifyjs src/ua-parser.js -o dist/ua-parser.pack.js --comments '/^ UA/' --compress --mangle && node -e \"const fs=require('fs');fs.writeFileSync('src/ua-parser.mjs','// Generated ESM version of UAParser.js\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/ua-parser.js\\n\\nconst window = undefined;\\n\\n'+fs.readFileSync('src/ua-parser.js','utf-8').replace(/\\(func[\\s\\S]+strict\\';/ig,'').replace(/\\/[\\/\\s]+export[\\s\\S]+/ig,'export {UAParser};'),'utf-8');fs.writeFileSync('src/enum/ua-parser-enum.mjs','// Generated ESM version of UAParser.js enums\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/enum/ua-parser-enum.js\\n\\n'+fs.readFileSync('src/enum/ua-parser-enum.js','utf-8').replace(/module\\.exports =/ig,'export'),'utf-8');fs.writeFileSync('src/extension/ua-parser-extension.mjs','// Generated ESM version of UAParser.js extensions\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/extension/ua-parser-extension.js\\n\\n'+fs.readFileSync('src/extension/ua-parser-extension.js','utf-8').replace(/const UA.+\\)/ig,'import UAParser from \\'ua-parser-js\\'').replace(/module\\.exports =/ig,'export'),'utf-8')\"",
|
||||||
"test": "jshint src/ua-parser.js && mocha -R nyan test/test.js",
|
"test": "jshint src/ua-parser.js && mocha -R nyan test",
|
||||||
"test-ci": "jshint src/ua-parser.js && mocha -R spec test/test.js",
|
"test-ci": "jshint src/ua-parser.js && mocha -R spec test",
|
||||||
"verup": "node ./node_modules/verup",
|
"verup": "node ./node_modules/verup",
|
||||||
"version": "node ./node_modules/verup 0"
|
"version": "node ./node_modules/verup 0"
|
||||||
},
|
},
|
||||||
@@ -113,13 +176,16 @@
|
|||||||
],
|
],
|
||||||
"regs": [
|
"regs": [
|
||||||
"^((?:\\$|(\\s*\\*\\s*@)|(\\s*(?:var|,)?\\s+))(?:LIBVERSION|version)[\\s\\:='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
|
"^((?:\\$|(\\s*\\*\\s*@)|(\\s*(?:var|,)?\\s+))(?:LIBVERSION|version)[\\s\\:='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
|
||||||
"^(\\s?\\*.*v)([0-9]+(?:\\.[0-9]+){2,2})"
|
"^(\\/?\\s?\\*.*v)([0-9]+(?:\\.[0-9]+){2,2})"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/parser": "7.15.8",
|
||||||
|
"@babel/traverse": "7.15.4",
|
||||||
"jshint": "~2.12.0",
|
"jshint": "~2.12.0",
|
||||||
"mocha": "~8.2.0",
|
"mocha": "~8.2.0",
|
||||||
"requirejs": "^2.3.2",
|
"requirejs": "^2.3.2",
|
||||||
|
"safe-regex": "^2.1.1",
|
||||||
"uglify-js": "~3.12.0",
|
"uglify-js": "~3.12.0",
|
||||||
"verup": "^1.3.x"
|
"verup": "^1.3.x"
|
||||||
},
|
},
|
||||||
@@ -147,6 +213,10 @@
|
|||||||
{
|
{
|
||||||
"type": "paypal",
|
"type": "paypal",
|
||||||
"url": "https://paypal.me/faisalman"
|
"url": "https://paypal.me/faisalman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/faisalman"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
428
readme.md
428
readme.md
@@ -12,24 +12,89 @@
|
|||||||
|
|
||||||
# UAParser.js
|
# UAParser.js
|
||||||
|
|
||||||
JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data with relatively small footprint (~17KB minified, ~6KB gzipped) that can be used either in browser (client-side) or node.js (server-side).
|
JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client-Hints data that can be used either in browser (client-side) or node.js (server-side).
|
||||||
|
|
||||||
* Author : Faisal Salman <<f@faisalman.com>>
|
* Author : Faisal Salman <<f@faisalman.com>>
|
||||||
* Demo : http://faisalman.github.io/ua-parser-js
|
* Demo : https://faisalman.github.io/ua-parser-js
|
||||||
* Source : https://github.com/faisalman/ua-parser-js
|
* Source : https://github.com/faisalman/ua-parser-js
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
### From Our Sponsors:
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="center" width="200px" rowspan="2"><a href="https://www.npmjs.com/package/@51degrees/ua-parser-js"><img src="images/51degrees.svg" alt="51degrees" width="75%" height="75%" ></a></td>
|
||||||
|
<td align="left" width="400px"><a href="https://www.npmjs.com/package/@51degrees/ua-parser-js">↗ @51degrees/ua-parser-js</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><br/><p>UAParser.js has been upgraded to detect comprehensive device data based on the User-Agent and User-Agent Client Hints.</p><p>This package supports all device types including Apple and Android devices and can be used either in a browser (client-side) or Node.js environment (server-side).</p><p>Visit <a href="https://www.npmjs.com/package/@51degrees/ua-parser-js">↗ 51Degrees <u>UAParser</u></a> to get started.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<a href="https://opencollective.com/ua-parser-js">↗ Become a sponsor</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Version 2.0
|
||||||
|
What's new & breaking, please read [CHANGELOG](changelog.md) before upgrading.
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
### UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])
|
||||||
|
|
||||||
|
In the browser environment you dont need to pass the user-agent string to the function, you can just call the funtion and it should automatically get the string from the `window.navigator.userAgent`, but that is not the case in nodejs. The user-agent string must be passed in' nodejs for the function to work. Usually you can find the user agent in: `request.headers["user-agent"]`.
|
||||||
|
|
||||||
|
|
||||||
## Constructor
|
## Constructor
|
||||||
|
When you call `UAParser` with the `new` keyword, `UAParser` will return a new instance with an empty result object, you have to call one of the available methods to get the information from the user-agent string.
|
||||||
|
Like so:
|
||||||
|
* `new UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])`
|
||||||
|
```js
|
||||||
|
let parser = new UAParser("your user-agent here"); // you need to pass the user-agent for nodejs
|
||||||
|
console.log(parser); // {}
|
||||||
|
let parserResults = parser.getResult();
|
||||||
|
console.log(parserResults);
|
||||||
|
/** {
|
||||||
|
"ua" : "",
|
||||||
|
"browser" : {},
|
||||||
|
"engine" : {},
|
||||||
|
"os" : {},
|
||||||
|
"device" : {},
|
||||||
|
"cpu" : {}
|
||||||
|
} */
|
||||||
|
```
|
||||||
|
|
||||||
* `new UAParser([uastring][,extensions])`
|
When you call UAParser without the `new` keyword, it will automatically call `getResult()` function and return the parsed results.
|
||||||
* returns new instance
|
* `UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])`
|
||||||
|
|
||||||
* `UAParser([uastring][,extensions])`
|
|
||||||
* returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
* returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
|
#### Methods table
|
||||||
|
The methods are self explanatory, here's a small overview on all the available methods:
|
||||||
|
* `getResult()` - returns all function object calls, user-agent string, browser info, cpu, device, engine, os:
|
||||||
|
`{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`.
|
||||||
|
|
||||||
|
* `getBrowser()` - returns the browser name and version.
|
||||||
|
* `getDevice()` - returns the device model, type, vendor.
|
||||||
|
* `getEngine()` - returns the current browser engine name and version.
|
||||||
|
* `getOS()` - returns the running operating system name and version.
|
||||||
|
* `getCPU()` - returns CPU architectural design name.
|
||||||
|
* `getUA()` - returns the user-agent string.
|
||||||
|
* `setUA(user-agent)` - set a custom user-agent to be parsed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
* `getResult()`
|
||||||
|
* returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
||||||
|
|
||||||
* `getBrowser()`
|
* `getBrowser()`
|
||||||
* returns `{ name: '', version: '' }`
|
* returns `{ name: '', version: '' }`
|
||||||
|
|
||||||
@@ -37,18 +102,19 @@ JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model fro
|
|||||||
# Possible 'browser.name':
|
# Possible 'browser.name':
|
||||||
2345Explorer, 360 Browser, Amaya, Android Browser, Arora, Avant, Avast, AVG,
|
2345Explorer, 360 Browser, Amaya, Android Browser, Arora, Avant, Avast, AVG,
|
||||||
BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
|
BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
|
||||||
Chrome Headless, Chrome WebView, Chrome, Chromium, Comodo Dragon, Dillo,
|
[Mobile] Chrome [Headless/WebView], Chromium, Cobalt, Comodo Dragon, Dillo,
|
||||||
Dolphin, Doris, Edge, Epiphany, Facebook, Falkon, Fennec, Firebird, Firefox,
|
Dolphin, Doris, DuckDuckGo, Edge, Electron, Epiphany, Facebook, Falkon, Fennec,
|
||||||
Flock, GSA, GoBrowser, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon,
|
Firebird, [Mobile] Firefox [Focus/Reality], Flock, Flow, GSA, GoBrowser, HeyTap,
|
||||||
Iceape, Iceweasel, Instagram, Iridium, Iron, Jasmine, K-Meleon, Kindle,
|
Huawei Browser, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceweasel,
|
||||||
Konqueror, LBBROWSER, Line, Links, Lunascape, Lynx, MIUI Browser,
|
Instagram, Iridium, Iron, Jasmine, Kakao[Story/Talk], K-Meleon, Kindle, Klar,
|
||||||
Maemo Browser, Maemo, Maxthon, MetaSr Midori, Minimo, Mobile Safari, Mosaic,
|
Konqueror, LBBROWSER, Line, LinkedIn, Links, Lunascape, Lynx, MIUI Browser,
|
||||||
Mozilla, NetFront, NetSurf, Netfront, Netscape, NokiaBrowser, Oculus Browser,
|
Maemo Browser, Maemo, Maxthon, MetaSr Midori, Minimo, Mosaic, Mozilla, NetFront,
|
||||||
OmniWeb, Opera Coast, Opera Mini, Opera Mobi, Opera Tablet, Opera, PaleMoon,
|
NetSurf, Netfront, Netscape, NokiaBrowser, Obigo, Oculus Browser, OmniWeb,
|
||||||
PhantomJS, Phoenix, Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark,
|
Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix, Polaris,
|
||||||
QupZilla, RockMelt, Safari, Sailfish Browser, Samsung Browser, SeaMonkey, Silk,
|
Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, [Mobile] Safari,
|
||||||
Skyfire, Sleipnir, Slim, SlimBrowser, Swiftfox, Tizen Browser, UCBrowser,
|
Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim,
|
||||||
Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser...
|
SlimBrowser, Swiftfox, Tesla, TikTok, Tizen Browser, UCBrowser, UP.Browser, Viera,
|
||||||
|
Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser, ...
|
||||||
|
|
||||||
# 'browser.version' determined dynamically
|
# 'browser.version' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -60,11 +126,19 @@ Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser...
|
|||||||
# Possible 'device.type':
|
# Possible 'device.type':
|
||||||
console, mobile, tablet, smarttv, wearable, embedded
|
console, mobile, tablet, smarttv, wearable, embedded
|
||||||
|
|
||||||
|
##########
|
||||||
|
# NOTE: 'desktop' is not a possible device type.
|
||||||
|
# UAParser only reports info directly available from the UA string, which is not the case for 'desktop' device type.
|
||||||
|
# If you wish to detect desktop devices, you must handle the needed logic yourself.
|
||||||
|
# You can read more about it in this issue: https://github.com/faisalman/ua-parser-js/issues/182
|
||||||
|
##########
|
||||||
|
|
||||||
# Possible 'device.vendor':
|
# Possible 'device.vendor':
|
||||||
Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, Essential,
|
Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
|
||||||
GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola,
|
Essential, Facebook, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Kobo,
|
||||||
Nexian, Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron,
|
Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus,
|
||||||
RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE, ...
|
OPPO, Ouya, Palm, Panasonic, Pebble, Polytron, Realme, RIM, Roku, Samsung, Sharp,
|
||||||
|
Siemens, Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
|
||||||
|
|
||||||
# 'device.model' determined dynamically
|
# 'device.model' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -74,8 +148,8 @@ RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE, ...
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Possible 'engine.name'
|
# Possible 'engine.name'
|
||||||
Amaya, Blink, EdgeHTML, Gecko, Goanna, iCab, KHTML, Links, Lynx, NetFront,
|
Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, LibWeb, Links, Lynx,
|
||||||
NetSurf, Presto, Tasman, Trident, w3m, WebKit
|
NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
|
||||||
|
|
||||||
# 'engine.version' determined dynamically
|
# 'engine.version' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -85,13 +159,15 @@ NetSurf, Presto, Tasman, Trident, w3m, WebKit
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Possible 'os.name'
|
# Possible 'os.name'
|
||||||
AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
|
AIX, Amiga OS, Android[-x86], Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
|
||||||
Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Fuchsia, Gentoo, GNU,
|
Contiki, Fedora, Firefox OS, FreeBSD, Debian, Deepin, DragonFly, elementary OS,
|
||||||
Haiku, Hurd, iOS, Joli, KaiOS, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo,
|
Fuchsia, Gentoo, GhostBSD, GNU, Haiku, HarmonyOS, HP-UX, Hurd, iOS, Joli, KaiOS,
|
||||||
Minix, Mint, Morph OS, NetBSD, Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD,
|
Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
|
||||||
PCLinuxOS, Plan9, PlayStation, QNX, RedHat, RIM Tablet OS, RISC OS, Sailfish,
|
Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
|
||||||
Series40, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, Unix, VectorLinux,
|
PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
|
||||||
WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
RISC OS, Sabayon, Sailfish, SerenityOS, Series40, Slackware, Solaris, SUSE, Symbian,
|
||||||
|
Tizen, Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile],
|
||||||
|
Zenwalk, ...
|
||||||
|
|
||||||
# 'os.version' determined dynamically
|
# 'os.version' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -101,12 +177,9 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Possible 'cpu.architecture'
|
# Possible 'cpu.architecture'
|
||||||
68k, amd64, arm[64], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64]
|
68k, amd64, arm[64/hf], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64]
|
||||||
```
|
```
|
||||||
|
|
||||||
* `getResult()`
|
|
||||||
* returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
|
||||||
|
|
||||||
* `getUA()`
|
* `getUA()`
|
||||||
* returns UA string of current instance
|
* returns UA string of current instance
|
||||||
|
|
||||||
@@ -114,6 +187,214 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
* set UA string to be parsed
|
* set UA string to be parsed
|
||||||
* returns current instance
|
* returns current instance
|
||||||
|
|
||||||
|
#### * `is():boolean` utility `since@2.0`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Is just a shorthand comparison to check whether the value of specified item equals one of its properties (in a case-insensitive way)
|
||||||
|
// so that instead of write it using `==` operator like this:
|
||||||
|
|
||||||
|
let ua = UAParser();
|
||||||
|
let device = ua.device;
|
||||||
|
let os = ua.os;
|
||||||
|
|
||||||
|
if (device.type == "mobile" && os.name != "iOS") {}
|
||||||
|
if (device.type == "smarttv" || device.vendor == "Samsung") {}
|
||||||
|
|
||||||
|
// we can also write the comparison above into as follow:
|
||||||
|
|
||||||
|
if (device.is("mobile") && !os.is("iOS")) {}
|
||||||
|
if (device.is("SmartTV") || device.is("SaMsUnG")) {}
|
||||||
|
|
||||||
|
/*
|
||||||
|
For device, properties will be checked in this particular order: type, model, vendor
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Another examples:
|
||||||
|
|
||||||
|
let uap = new UAParser('Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537');
|
||||||
|
|
||||||
|
uap.getBrowser().name; // "IEMobile"
|
||||||
|
uap.getBrowser().is("IEMobile"); // true
|
||||||
|
uap.getCPU().is("ARM"); // true
|
||||||
|
|
||||||
|
uap.getOS().name; // "Windows Phone"
|
||||||
|
uap.getOS().is("Windows Phone"); // true
|
||||||
|
|
||||||
|
uap.getDevice(); // { vendor: "Nokia", model: "Lumia 635", type: "mobile" }
|
||||||
|
uap.getResult().device; // { vendor: "Nokia", model: "Lumia 635", type: "mobile" }
|
||||||
|
|
||||||
|
let device = uap.getDevice();
|
||||||
|
device.is("mobile"); // true
|
||||||
|
device.is("Lumia 635"); // true
|
||||||
|
device.is("Nokia"); // true
|
||||||
|
device.is("iPhone"); // false
|
||||||
|
uap.getResult().device.is("Nokia"); // true
|
||||||
|
uap.getResult().device.model; // "Lumia 635"
|
||||||
|
|
||||||
|
uap.setUA("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36");
|
||||||
|
|
||||||
|
let browser = uap.getBrowser();
|
||||||
|
browser.is("IEMobile"); // false
|
||||||
|
browser.is("Chrome"); // true
|
||||||
|
|
||||||
|
uap.getResult().browser.is("Edge"); // false
|
||||||
|
uap.getResult().os.name // "Mac OS"
|
||||||
|
uap.getResult().os.is("Mac OS"); // true
|
||||||
|
uap.getResult().os.version; // "10.6.8"
|
||||||
|
|
||||||
|
let engine = uap.getEngine();
|
||||||
|
engine.is("Blink"); // true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### * `toString():string` utility `since@2.0`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Retrieve full-name values as a string
|
||||||
|
|
||||||
|
/*
|
||||||
|
Values will be concatenated following this pattern:
|
||||||
|
* browser : name + version
|
||||||
|
* cpu : architecture
|
||||||
|
* device : vendor + model
|
||||||
|
* engine : name + version
|
||||||
|
* os : name + version
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Usage examples
|
||||||
|
|
||||||
|
let uap = new UAParser('Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537');
|
||||||
|
|
||||||
|
uap.getDevice(); // {
|
||||||
|
// vendor: "Nokia",
|
||||||
|
// model: "Lumia 635",
|
||||||
|
// type: "mobile"
|
||||||
|
// }
|
||||||
|
uap.getDevice().toString(); // "Nokia Lumia 635"
|
||||||
|
|
||||||
|
uap.getResult().os.name; // "Windows Phone"
|
||||||
|
uap.getResult().os.version; // "8.1"
|
||||||
|
uap.getResult().os.toString(); // "Windows Phone 8.1"
|
||||||
|
|
||||||
|
uap.setUA("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36");
|
||||||
|
uap.getBrowser().name; // "Chrome"
|
||||||
|
uap.getBrowser().version; // "28.0.1500.95"
|
||||||
|
uap.getBrowser().major; // "28"
|
||||||
|
uap.getBrowser().toString(); // "Chrome 28.0.1500.95"
|
||||||
|
|
||||||
|
let engine = uap.getEngine();
|
||||||
|
engine.name; // "Blink"
|
||||||
|
engine.version; // "28.0.1500.95"
|
||||||
|
engine.toString(); // "Blink 28.0.1500.95"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### * `withClientHints():Promise<object>|Thenable<object>|object` `since@2.0`
|
||||||
|
|
||||||
|
Recently, Chrome limits the information exposed through user-agent and introduces a new experimental set of data called "client-hints". In browser-environment, obtaining the client-hints data via JavaScript must be done in an asynchronous way. In `UAParser` you can chain the result object from `get*` method with `withClientHints()` to also read the client-hints data from the browser and return the updated data as a `Promise`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// client-side example
|
||||||
|
(async function () {
|
||||||
|
let ua = new UAParser();
|
||||||
|
|
||||||
|
// get browser data from user-agent only :
|
||||||
|
let browser = ua.getBrowser();
|
||||||
|
console.log('Using User-Agent: ', browser);
|
||||||
|
|
||||||
|
// get browser data from client-hints (with user-agent as fallback) :
|
||||||
|
browser = await ua.getBrowser().withClientHints();
|
||||||
|
console.log('Using Client-Hints: ', browser);
|
||||||
|
|
||||||
|
// alternatively :
|
||||||
|
ua.getBrowser().withClientHints().then(function (browser) {
|
||||||
|
console.log('Using Client-Hints: ', browser);
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
|
Along with `User-Agent` HTTP header, Chrome also sends this client-hints data by default under `Sec-CH-UA-*` HTTP headers in each request. In server-side development, you can capture this extra information by passing the `req.headers` to `UAParser()` (see examples below). When using `withClientHints()` in nodejs environment and browser without client-hints support (basically anything that's not Chromium-based), it will returns a new object with updated data.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// server-side example
|
||||||
|
|
||||||
|
// Suppose we got a request having these HTTP headers:
|
||||||
|
const request = {
|
||||||
|
headers : {
|
||||||
|
'user-agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
|
||||||
|
|
||||||
|
'sec-ch-ua-mobile' : '?1',
|
||||||
|
'sec-ch-ua-model' : 'Galaxy S3 Marketing',
|
||||||
|
'sec-ch-ua-platform' : 'Android'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const result1 = UAParser(request.headers); // parse only "user-agent" header
|
||||||
|
const result2 = UAParser(request.headers).withClientHints(); // update with "sec-ch-ua" headers
|
||||||
|
|
||||||
|
console.log(result1.os.name); // "Linux"
|
||||||
|
console.log(result1.device.type); // undefined
|
||||||
|
console.log(result1.device.model); // undefined
|
||||||
|
|
||||||
|
console.log(result2.os.name); // "Android"
|
||||||
|
console.log(result2.device.type); // "mobile"
|
||||||
|
console.log(result2.device.model); // "Galaxy S3 Marketing"
|
||||||
|
|
||||||
|
new UAParser(request.headers)
|
||||||
|
.getBrowser()
|
||||||
|
.withClientHints()
|
||||||
|
.then((browser) => {
|
||||||
|
console.log(browser.toString()); // Chrome 110.0.0.0
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Extending Regex
|
||||||
|
|
||||||
|
If you want to detect something that's not currently provided by UAParser.js (eg: `bots`, specific apps, etc), you can pass a list of regexes to extend internal UAParser.js regexes with your own.
|
||||||
|
|
||||||
|
* `UAParser([uastring,] extensions [,headers:object(since@2.0)])`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Example:
|
||||||
|
const myOwnListOfBrowsers = [
|
||||||
|
[/(mybrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, ['type', 'bot']]
|
||||||
|
];
|
||||||
|
|
||||||
|
const myUA = 'Mozilla/5.0 MyBrowser/1.3';
|
||||||
|
|
||||||
|
let myParser = new UAParser({ browser: myOwnListOfBrowsers });
|
||||||
|
|
||||||
|
console.log(myParser.setUA(myUA).getBrowser()); // {name: "MyBrowser", version: "1.3", major: "1", type : "bot"}
|
||||||
|
console.log(myParser.getBrowser().is('bot')); // true
|
||||||
|
|
||||||
|
// Another example:
|
||||||
|
const myOwnListOfDevices = [
|
||||||
|
[/(mytab) ([\w ]+)/i], [UAParser.DEVICE.VENDOR, UAParser.DEVICE.MODEL, [UAParser.DEVICE.TYPE, UAParser.DEVICE.TABLET]],
|
||||||
|
[/(myphone)/i], [UAParser.DEVICE.VENDOR, [UAParser.DEVICE.TYPE, UAParser.DEVICE.MOBILE]]
|
||||||
|
];
|
||||||
|
|
||||||
|
const myUA2 = 'Mozilla/5.0 MyTab 14 Pro Max';
|
||||||
|
|
||||||
|
let myParser2 = new UAParser({
|
||||||
|
browser: myOwnListOfBrowsers,
|
||||||
|
device: myOwnListOfDevices
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(myParser2.setUA(myUA2).getDevice()); // {vendor: "MyTab", model: "14 Pro Max", type: "tablet"}
|
||||||
|
```
|
||||||
|
|
||||||
|
Some basic extensions (although not very complete at the moment) can also be found under `ua-parser-js/extensions` submodule.
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { UAParser } from 'ua-parser-js';
|
||||||
|
import { Emails } from 'ua-parser-js/extensions';
|
||||||
|
|
||||||
|
const browser = new UAParser(Emails)
|
||||||
|
.setUA('Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0')
|
||||||
|
.getBrowser();
|
||||||
|
|
||||||
|
console.log(browser.name); // Thunderbird
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
## Using HTML
|
## Using HTML
|
||||||
@@ -125,8 +406,8 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
<script src="ua-parser.min.js"></script>
|
<script src="ua-parser.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var parser = new UAParser();
|
var uap = new UAParser();
|
||||||
console.log(parser.getResult());
|
console.log(uap.getResult());
|
||||||
/*
|
/*
|
||||||
/// This will print an object structured like this:
|
/// This will print an object structured like this:
|
||||||
{
|
{
|
||||||
@@ -134,7 +415,7 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
browser: {
|
browser: {
|
||||||
name: "",
|
name: "",
|
||||||
version: "",
|
version: "",
|
||||||
major: "" //@deprecated
|
major: ""
|
||||||
},
|
},
|
||||||
engine: {
|
engine: {
|
||||||
name: "",
|
name: "",
|
||||||
@@ -158,10 +439,10 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
|
|
||||||
// Now let's try a custom user-agent string as an example
|
// Now let's try a custom user-agent string as an example
|
||||||
var uastring1 = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2";
|
var uastring1 = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2";
|
||||||
parser.setUA(uastring1);
|
uap.setUA(uastring1);
|
||||||
var result = parser.getResult();
|
var result = uap.getResult();
|
||||||
// You can also use UAParser constructor directly without having to create an instance:
|
// You can also use UAParser constructor directly without having to create an instance:
|
||||||
// var result = UAParser(uastring1);
|
// var ua = UAParser(uastring1);
|
||||||
|
|
||||||
console.log(result.browser); // {name: "Chromium", version: "15.0.874.106"}
|
console.log(result.browser); // {name: "Chromium", version: "15.0.874.106"}
|
||||||
console.log(result.device); // {model: undefined, type: undefined, vendor: undefined}
|
console.log(result.device); // {model: undefined, type: undefined, vendor: undefined}
|
||||||
@@ -172,14 +453,14 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
|
|
||||||
// Do some other tests
|
// Do some other tests
|
||||||
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
||||||
console.log(parser.setUA(uastring2).getBrowser().name); // "Konqueror"
|
console.log(uap.setUA(uastring2).getBrowser().name); // "Konqueror"
|
||||||
console.log(parser.getOS()); // {name: "OpenBSD", version: undefined}
|
console.log(uap.getOS()); // {name: "OpenBSD", version: undefined}
|
||||||
console.log(parser.getEngine()); // {name: "KHTML", version: "4.1.4"}
|
console.log(uap.getEngine()); // {name: "KHTML", version: "4.1.4"}
|
||||||
|
|
||||||
var uastring3 = 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11';
|
var uastring3 = 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11';
|
||||||
console.log(parser.setUA(uastring3).getDevice().model); // "PlayBook"
|
console.log(uap.setUA(uastring3).getDevice().model); // "PlayBook"
|
||||||
console.log(parser.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
|
console.log(uap.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
|
||||||
console.log(parser.getBrowser().name); // "Safari"
|
console.log(uap.getBrowser().name); // "Safari"
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@@ -190,17 +471,32 @@ WebOS, Windows [Phone/Mobile], Zenwalk, ...
|
|||||||
|
|
||||||
## Using node.js
|
## Using node.js
|
||||||
|
|
||||||
|
Note: Device information is not available in the NodeJS environment.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install ua-parser-js
|
$ npm install ua-parser-js
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var parser = require('ua-parser-js');
|
var uap = require('ua-parser-js');
|
||||||
|
|
||||||
http.createServer(function (req, res) {
|
http.createServer(function (req, res) {
|
||||||
// get user-agent header
|
// get user-agent header
|
||||||
var ua = parser(req.headers['user-agent']);
|
var ua = uap(req.headers['user-agent']);
|
||||||
|
|
||||||
|
/* // BEGIN since@2.0 - you can also pass client-hints data to UAParser
|
||||||
|
|
||||||
|
// note: only works in secure context (https:// or localhost or file://)
|
||||||
|
|
||||||
|
var getHighEntropyValues = 'Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Arch, Sec-CH-UA-Bitness';
|
||||||
|
res.setHeader('Accept-CH', getHighEntropyValues);
|
||||||
|
res.setHeader('Critical-CH', getHighEntropyValues);
|
||||||
|
|
||||||
|
var ua = uap(req.headers).withClientHints();
|
||||||
|
|
||||||
|
// END since@2.0 */
|
||||||
|
|
||||||
// write the result as response
|
// write the result as response
|
||||||
res.end(JSON.stringify(ua, null, ' '));
|
res.end(JSON.stringify(ua, null, ' '));
|
||||||
})
|
})
|
||||||
@@ -209,6 +505,19 @@ http.createServer(function (req, res) {
|
|||||||
console.log('Server running at http://127.0.0.1:1337/');
|
console.log('Server running at http://127.0.0.1:1337/');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using ES Modules
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { UAParser } from 'ua-parser-js';
|
||||||
|
|
||||||
|
const { browser, cpu, device } = UAParser('Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090928 Firefox/3.5 Maemo Browser 1.4.1.22 RX-51 N900');
|
||||||
|
|
||||||
|
console.log(browser.name); // Maemo Browser
|
||||||
|
console.log(cpu.is('arm')); // true
|
||||||
|
console.log(device.is('mobile')); // true
|
||||||
|
console.log(device.model); // N900
|
||||||
|
```
|
||||||
|
|
||||||
## Using TypeScript
|
## Using TypeScript
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -244,25 +553,12 @@ console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4
|
|||||||
$('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua.device.type);
|
$('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua.device.type);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using Extension
|
|
||||||
|
|
||||||
* `UAParser([uastring,] extensions)`
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Example:
|
|
||||||
var myOwnListOfBrowsers = [
|
|
||||||
[/(mybrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
|
|
||||||
];
|
|
||||||
var myParser = new UAParser({ browser: myOwnListOfBrowsers });
|
|
||||||
var myUA = 'Mozilla/5.0 MyBrowser/1.3';
|
|
||||||
console.log(myParser.setUA(myUA).getBrowser()); // {name: "MyBrowser", version: "1.3"}
|
|
||||||
```
|
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|
||||||
## Sponsors
|
## Backers & Sponsors
|
||||||
|
|
||||||
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/tiers/backers.svg?avatarHeight=64" height="80"/></a> <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/tiers/sponsors.svg?avatarHeight=64" height="80"/></a>
|
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a>
|
||||||
|
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a>
|
||||||
|
|
||||||
<a href="https://www.paypal.me/faisalman/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" height="40"></a>
|
<a href="https://www.paypal.me/faisalman/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" height="40"></a>
|
||||||
|
|
||||||
@@ -286,7 +582,7 @@ Made with [contributors-img](https://contrib.rocks).
|
|||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2012-2021 Faisal Salman <<f@faisalman.com>>
|
Copyright (c) 2012-2023 Faisal Salman <<f@faisalman.com>>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
5
security.md
Normal file
5
security.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Please report security issues to `f@faisalman.com`
|
||||||
101
src/enum/ua-parser-enum.js
Normal file
101
src/enum/ua-parser-enum.js
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
///////////////////////////////////////////////
|
||||||
|
/* Enums for UAParser.js v2.0.0-alpha.2
|
||||||
|
https://github.com/faisalman/ua-parser-js
|
||||||
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
|
MIT License */
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
const BrowserName = Object.freeze({
|
||||||
|
CHROME : 'Chrome',
|
||||||
|
EDGE : 'Edge',
|
||||||
|
SAFARI : 'Safari',
|
||||||
|
FIREFOX : 'Firefox',
|
||||||
|
OPERA : 'Opera',
|
||||||
|
MOBILE_CHROME : 'Mobile Chrome',
|
||||||
|
MOBILE_SAFARI : 'Mobile Safari',
|
||||||
|
MOBILE_FIREFOX : 'Mobile Firefox',
|
||||||
|
ANDROID_BROWSER : 'Android Browser'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
const CPUArch = Object.freeze({
|
||||||
|
IA32 : 'ia32',
|
||||||
|
AMD64 : 'amd64',
|
||||||
|
IA64 : 'ia64',
|
||||||
|
ARM : 'arm',
|
||||||
|
ARM64 : 'arm64',
|
||||||
|
ARMHF : 'armhf',
|
||||||
|
_68K : '68k',
|
||||||
|
AVR : 'avr',
|
||||||
|
IRIX : 'irix',
|
||||||
|
IRIX64 : 'irix64',
|
||||||
|
MIPS : 'mips',
|
||||||
|
MIPS64 : 'mips64',
|
||||||
|
PPC : 'ppc',
|
||||||
|
SPARC : 'sparc',
|
||||||
|
SPARC64 : 'sparc64'
|
||||||
|
});
|
||||||
|
|
||||||
|
const DeviceType = Object.freeze({
|
||||||
|
MOBILE : 'mobile',
|
||||||
|
TABLET : 'tablet',
|
||||||
|
SMARTTV : 'smarttv',
|
||||||
|
CONSOLE : 'console',
|
||||||
|
WEARABLE: 'wearable',
|
||||||
|
EMBEDDED: 'embedded'
|
||||||
|
});
|
||||||
|
|
||||||
|
const DeviceVendor = Object.freeze({
|
||||||
|
APPLE : 'Apple',
|
||||||
|
SAMSUNG : 'Samsung',
|
||||||
|
HUAWEI : 'Huawei',
|
||||||
|
XIAOMI : 'Xiaomi',
|
||||||
|
OPPO : 'OPPO',
|
||||||
|
VIVO : 'Vivo',
|
||||||
|
REALME : 'Realme',
|
||||||
|
LENOVO : 'Lenovo',
|
||||||
|
LG : 'LG'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
const EngineName = Object.freeze({
|
||||||
|
AMAYA : 'Amaya',
|
||||||
|
BLINK : 'Blink',
|
||||||
|
EDGEHTML: 'EdgeHTML',
|
||||||
|
FLOW : 'Flow',
|
||||||
|
GECKO : 'Gecko',
|
||||||
|
GOANNA : 'Goanna',
|
||||||
|
ICAB : 'iCab',
|
||||||
|
LIBWEB : 'LibWeb',
|
||||||
|
KHTML : 'KHTML',
|
||||||
|
LINKS : 'Links',
|
||||||
|
LYNX : 'Lynx',
|
||||||
|
NETFRONT: 'NetFront',
|
||||||
|
NETSURF : 'NetSurf',
|
||||||
|
PRESTO : 'Presto',
|
||||||
|
TASMAN : 'Tasman',
|
||||||
|
TRIDENT : 'Trident',
|
||||||
|
W3M : 'w3m',
|
||||||
|
WEBKIT : 'WebKit'
|
||||||
|
});
|
||||||
|
|
||||||
|
const OSName = Object.freeze({
|
||||||
|
WINDOWS : 'Windows',
|
||||||
|
LINUX : 'Linux',
|
||||||
|
MACOS : 'macOS',
|
||||||
|
IOS : 'iOS',
|
||||||
|
ANDROID : 'Android'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
BrowserName,
|
||||||
|
CPUArch,
|
||||||
|
DeviceType,
|
||||||
|
DeviceVendor,
|
||||||
|
EngineName,
|
||||||
|
OSName
|
||||||
|
}
|
||||||
105
src/enum/ua-parser-enum.mjs
Normal file
105
src/enum/ua-parser-enum.mjs
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
// Generated ESM version of UAParser.js enums
|
||||||
|
// DO NOT EDIT THIS FILE!
|
||||||
|
// Source: /src/enum/ua-parser-enum.js
|
||||||
|
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
/* Enums for UAParser.js v2.0.0-alpha.2
|
||||||
|
https://github.com/faisalman/ua-parser-js
|
||||||
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
|
MIT License */
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
const BrowserName = Object.freeze({
|
||||||
|
CHROME : 'Chrome',
|
||||||
|
EDGE : 'Edge',
|
||||||
|
SAFARI : 'Safari',
|
||||||
|
FIREFOX : 'Firefox',
|
||||||
|
OPERA : 'Opera',
|
||||||
|
MOBILE_CHROME : 'Mobile Chrome',
|
||||||
|
MOBILE_SAFARI : 'Mobile Safari',
|
||||||
|
MOBILE_FIREFOX : 'Mobile Firefox',
|
||||||
|
ANDROID_BROWSER : 'Android Browser'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
const CPUArch = Object.freeze({
|
||||||
|
IA32 : 'ia32',
|
||||||
|
AMD64 : 'amd64',
|
||||||
|
IA64 : 'ia64',
|
||||||
|
ARM : 'arm',
|
||||||
|
ARM64 : 'arm64',
|
||||||
|
ARMHF : 'armhf',
|
||||||
|
_68K : '68k',
|
||||||
|
AVR : 'avr',
|
||||||
|
IRIX : 'irix',
|
||||||
|
IRIX64 : 'irix64',
|
||||||
|
MIPS : 'mips',
|
||||||
|
MIPS64 : 'mips64',
|
||||||
|
PPC : 'ppc',
|
||||||
|
SPARC : 'sparc',
|
||||||
|
SPARC64 : 'sparc64'
|
||||||
|
});
|
||||||
|
|
||||||
|
const DeviceType = Object.freeze({
|
||||||
|
MOBILE : 'mobile',
|
||||||
|
TABLET : 'tablet',
|
||||||
|
SMARTTV : 'smarttv',
|
||||||
|
CONSOLE : 'console',
|
||||||
|
WEARABLE: 'wearable',
|
||||||
|
EMBEDDED: 'embedded'
|
||||||
|
});
|
||||||
|
|
||||||
|
const DeviceVendor = Object.freeze({
|
||||||
|
APPLE : 'Apple',
|
||||||
|
SAMSUNG : 'Samsung',
|
||||||
|
HUAWEI : 'Huawei',
|
||||||
|
XIAOMI : 'Xiaomi',
|
||||||
|
OPPO : 'OPPO',
|
||||||
|
VIVO : 'Vivo',
|
||||||
|
REALME : 'Realme',
|
||||||
|
LENOVO : 'Lenovo',
|
||||||
|
LG : 'LG'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
const EngineName = Object.freeze({
|
||||||
|
AMAYA : 'Amaya',
|
||||||
|
BLINK : 'Blink',
|
||||||
|
EDGEHTML: 'EdgeHTML',
|
||||||
|
FLOW : 'Flow',
|
||||||
|
GECKO : 'Gecko',
|
||||||
|
GOANNA : 'Goanna',
|
||||||
|
ICAB : 'iCab',
|
||||||
|
LIBWEB : 'LibWeb',
|
||||||
|
KHTML : 'KHTML',
|
||||||
|
LINKS : 'Links',
|
||||||
|
LYNX : 'Lynx',
|
||||||
|
NETFRONT: 'NetFront',
|
||||||
|
NETSURF : 'NetSurf',
|
||||||
|
PRESTO : 'Presto',
|
||||||
|
TASMAN : 'Tasman',
|
||||||
|
TRIDENT : 'Trident',
|
||||||
|
W3M : 'w3m',
|
||||||
|
WEBKIT : 'WebKit'
|
||||||
|
});
|
||||||
|
|
||||||
|
const OSName = Object.freeze({
|
||||||
|
WINDOWS : 'Windows',
|
||||||
|
LINUX : 'Linux',
|
||||||
|
MACOS : 'macOS',
|
||||||
|
IOS : 'iOS',
|
||||||
|
ANDROID : 'Android'
|
||||||
|
|
||||||
|
// TODO : test!
|
||||||
|
});
|
||||||
|
|
||||||
|
export {
|
||||||
|
BrowserName,
|
||||||
|
CPUArch,
|
||||||
|
DeviceType,
|
||||||
|
DeviceVendor,
|
||||||
|
EngineName,
|
||||||
|
OSName
|
||||||
|
}
|
||||||
120
src/extension/ua-parser-extension.js
Normal file
120
src/extension/ua-parser-extension.js
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
///////////////////////////////////////////////
|
||||||
|
/* Extensions for UAParser.js v2.0.0-alpha.2
|
||||||
|
https://github.com/faisalman/ua-parser-js
|
||||||
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
|
MIT License */
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
const MODEL = 'model';
|
||||||
|
const NAME = 'name';
|
||||||
|
const TYPE = 'type';
|
||||||
|
const VENDOR = 'vendor';
|
||||||
|
const VERSION = 'version';
|
||||||
|
const MOBILE = 'mobile';
|
||||||
|
const TABLET = 'tablet';
|
||||||
|
|
||||||
|
const Bots = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// Googlebot / BingBot / MSNBot / FacebookBot
|
||||||
|
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const ExtraDevices = Object.freeze({
|
||||||
|
device : [
|
||||||
|
[
|
||||||
|
/(nook)[\w ]+build\/(\w+)/i, // Nook
|
||||||
|
/(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
||||||
|
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
||||||
|
/(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
||||||
|
/(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
||||||
|
/(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
||||||
|
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/(u304aa)/i // AT&T
|
||||||
|
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\bsie-(\w*)/i // Siemens
|
||||||
|
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(rct\w+) b/i // RCA Tablets
|
||||||
|
], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(tm\d{3}\w+) b/i
|
||||||
|
], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(k88) b/i // ZTE K Series Tablet
|
||||||
|
], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(nx\d{3}j) b/i // ZTE Nubia
|
||||||
|
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
||||||
|
], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b([yr]\d{2}) b/i,
|
||||||
|
/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Dragon Touch'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
||||||
|
], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
||||||
|
], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
||||||
|
], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(ph-1) /i // Essential PH-1
|
||||||
|
], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
||||||
|
], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\btu_(1491) b/i // Rotor Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const Emails = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// Microsoft Outlook / Thunderbird
|
||||||
|
[/(microsoft outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, 'email']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const Tools = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// wget / curl / lynx
|
||||||
|
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'tool']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
Bots,
|
||||||
|
ExtraDevices,
|
||||||
|
Emails,
|
||||||
|
Tools
|
||||||
|
}
|
||||||
124
src/extension/ua-parser-extension.mjs
Normal file
124
src/extension/ua-parser-extension.mjs
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
// Generated ESM version of UAParser.js extensions
|
||||||
|
// DO NOT EDIT THIS FILE!
|
||||||
|
// Source: /src/extension/ua-parser-extension.js
|
||||||
|
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
/* Extensions for UAParser.js v2.0.0-alpha.2
|
||||||
|
https://github.com/faisalman/ua-parser-js
|
||||||
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
|
MIT License */
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
|
||||||
|
const MODEL = 'model';
|
||||||
|
const NAME = 'name';
|
||||||
|
const TYPE = 'type';
|
||||||
|
const VENDOR = 'vendor';
|
||||||
|
const VERSION = 'version';
|
||||||
|
const MOBILE = 'mobile';
|
||||||
|
const TABLET = 'tablet';
|
||||||
|
|
||||||
|
const Bots = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// Googlebot / BingBot / MSNBot / FacebookBot
|
||||||
|
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const ExtraDevices = Object.freeze({
|
||||||
|
device : [
|
||||||
|
[
|
||||||
|
/(nook)[\w ]+build\/(\w+)/i, // Nook
|
||||||
|
/(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
||||||
|
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
||||||
|
/(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
||||||
|
/(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
||||||
|
/(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
||||||
|
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/(u304aa)/i // AT&T
|
||||||
|
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\bsie-(\w*)/i // Siemens
|
||||||
|
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(rct\w+) b/i // RCA Tablets
|
||||||
|
], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(tm\d{3}\w+) b/i
|
||||||
|
], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(k88) b/i // ZTE K Series Tablet
|
||||||
|
], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(nx\d{3}j) b/i // ZTE Nubia
|
||||||
|
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
||||||
|
], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b([yr]\d{2}) b/i,
|
||||||
|
/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
||||||
|
], [MODEL, [VENDOR, 'Dragon Touch'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
||||||
|
], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
||||||
|
], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
||||||
|
], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(ph-1) /i // Essential PH-1
|
||||||
|
], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
||||||
|
], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\btu_(1491) b/i // Rotor Tablets
|
||||||
|
], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const Emails = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// Microsoft Outlook / Thunderbird
|
||||||
|
[/(microsoft outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, 'email']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const Tools = Object.freeze({
|
||||||
|
browser : [
|
||||||
|
// wget / curl / lynx
|
||||||
|
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'tool']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
export {
|
||||||
|
Bots,
|
||||||
|
ExtraDevices,
|
||||||
|
Emails,
|
||||||
|
Tools
|
||||||
|
}
|
||||||
1470
src/ua-parser.js
1470
src/ua-parser.js
File diff suppressed because it is too large
Load Diff
1126
src/ua-parser.mjs
Normal file
1126
src/ua-parser.mjs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -159,6 +159,16 @@
|
|||||||
"major" : "2"
|
"major" : "2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Camino on Mac",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.2.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Camino",
|
||||||
|
"version" : "2.2.1",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Chimera",
|
"desc" : "Chimera",
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-PL; rv:1.0.1) Gecko/20021111 Chimera/0.6",
|
"ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-PL; rv:1.0.1) Gecko/20021111 Chimera/0.6",
|
||||||
@@ -179,6 +189,16 @@
|
|||||||
"major" : "20"
|
"major" : "20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Chrome",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4758.102 Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Chrome",
|
||||||
|
"version" : "100.0.4758.102",
|
||||||
|
"major" : "100"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Chrome Headless",
|
"desc" : "Chrome Headless",
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36",
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36",
|
||||||
@@ -214,7 +234,7 @@
|
|||||||
"ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3",
|
"ua" : "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "Chrome",
|
"name" : "Mobile Chrome",
|
||||||
"version" : "19.0.1084.60",
|
"version" : "19.0.1084.60",
|
||||||
"major" : "19"
|
"major" : "19"
|
||||||
}
|
}
|
||||||
@@ -234,7 +254,7 @@
|
|||||||
"ua" : "Mozilla/5.0 (Linux; U; Android-4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7",
|
"ua" : "Mozilla/5.0 (Linux; U; Android-4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "Chrome",
|
"name" : "Mobile Chrome",
|
||||||
"version" : "16.0.912.75",
|
"version" : "16.0.912.75",
|
||||||
"major" : "16"
|
"major" : "16"
|
||||||
}
|
}
|
||||||
@@ -279,6 +299,16 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "DuckDuckGo",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 8.1.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.131 Mobile DuckDuckGo/5 Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "DuckDuckGo",
|
||||||
|
"version" : "5",
|
||||||
|
"major" : "5"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Epiphany",
|
"desc" : "Epiphany",
|
||||||
"ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6",
|
"ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6",
|
||||||
@@ -289,6 +319,16 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Flow",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) EkiohFlow/5.7.4.30559 Flow/5.7.4 (like Gecko Firefox/53.0 rv:53.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Flow",
|
||||||
|
"version" : "5.7.4",
|
||||||
|
"major" : "5"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Waterfox",
|
"desc" : "Waterfox",
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.2.2 Waterfox/55.2.2",
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.2.2 Waterfox/55.2.2",
|
||||||
@@ -389,6 +429,26 @@
|
|||||||
"major" : "15"
|
"major" : "15"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Firefox",
|
||||||
|
"version" : "100.0",
|
||||||
|
"major" : "100"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox Reality",
|
||||||
|
"ua" : "Mozilla/5.0 (Android 7.1.2; Mobile VR; rv:65.0) Gecko/65.0 Firefox/65.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Firefox Reality",
|
||||||
|
"version" : "65.0",
|
||||||
|
"major" : "65"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Firefox-based browser",
|
"desc" : "Firefox-based browser",
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0 AppName/1.0",
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0 AppName/1.0",
|
||||||
@@ -409,6 +469,16 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox for Maemo (Nokia N900)",
|
||||||
|
"ua" : "Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Fennec",
|
||||||
|
"version" : "10.0.1",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc": "Firefox Focus",
|
"desc": "Firefox Focus",
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/6.1.1 Chrome/68.0.3440.91 Mobile Safari/537.36",
|
"ua": "Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/6.1.1 Chrome/68.0.3440.91 Mobile Safari/537.36",
|
||||||
@@ -438,6 +508,56 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HeyTap",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.61 Safari/537.36 HeyTapBrowser/40.8.10.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "HeyTap",
|
||||||
|
"version" : "40.8.10.1",
|
||||||
|
"major" : "40"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HuaweiBrowser",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00;HMSCore/4.0.0 GMS/10.4 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 HuaweiBrowser/10.0.3.102 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Huawei Browser",
|
||||||
|
"version" : "10.0.3.102",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HuaweiBrowser",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00;HMSCore/4.0.0 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 HuaweiBrowser/10.0.3.102 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Huawei Browser",
|
||||||
|
"version" : "10.0.3.102",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HuaweiBrowser",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00;GMS/10.4 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 HuaweiBrowser/10.0.3.102 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Huawei Browser",
|
||||||
|
"version" : "10.0.3.102",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HuaweiBrowser",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.64 HuaweiBrowser/10.0.3.102 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Huawei Browser",
|
||||||
|
"version" : "10.0.3.102",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "IceApe",
|
"desc" : "IceApe",
|
||||||
"ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110817 Iceape/2.0.14",
|
"ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.19) Gecko/20110817 Iceape/2.0.14",
|
||||||
@@ -648,6 +768,16 @@
|
|||||||
"major" : "4"
|
"major" : "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mobile Safari",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari/604.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Safari",
|
||||||
|
"version" : "undefined",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Mosaic",
|
"desc" : "Mosaic",
|
||||||
"ua" : "NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m)",
|
"ua" : "NCSA_Mosaic/2.6 (X11; SunOS 4.1.3 sun4m)",
|
||||||
@@ -708,6 +838,16 @@
|
|||||||
"major" : "8"
|
"major" : "8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Netscape 6",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows; U; Win95; de-DE; rv:0.9.2) Gecko/20010726 Netscape6/6.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Netscape",
|
||||||
|
"version" : "6.1",
|
||||||
|
"major" : "6"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Nokia Browser",
|
"desc" : "Nokia Browser",
|
||||||
"ua" : "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/025.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.37 Mobile Safari/533.4 3gpp-gba",
|
"ua" : "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/025.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.37 Mobile Safari/533.4 3gpp-gba",
|
||||||
@@ -718,6 +858,26 @@
|
|||||||
"major" : "7"
|
"major" : "7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Obigo",
|
||||||
|
"ua" : "LG-GS290/V100 Obigo/WAP2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Obigo",
|
||||||
|
"version" : "WAP2.0",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Obigo",
|
||||||
|
"ua" : "LG/KU990i/v10a Browser/Obigo-Q05A/3.6 MMS/LG-MMS-V1.0/1.2 Java/ASVM/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Obigo",
|
||||||
|
"version" : "Q05A",
|
||||||
|
"major" : "05"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Oculus Browser",
|
"desc" : "Oculus Browser",
|
||||||
"ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36",
|
"ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36",
|
||||||
@@ -728,6 +888,16 @@
|
|||||||
"major" : "3"
|
"major" : "3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Oculus Browser",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 10; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/15.0.0.0.22.280317669 SamsungBrowser/4.0 Chrome/89.0.4389.90 VR Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Oculus Browser",
|
||||||
|
"version" : "15.0.0.0.22.280317669",
|
||||||
|
"major" : "15"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "OmniWeb",
|
"desc" : "OmniWeb",
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.48",
|
"ua" : "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.48",
|
||||||
@@ -938,6 +1108,16 @@
|
|||||||
"major" : "2"
|
"major" : "2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "SeaMonkey on Mac",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "SeaMonkey",
|
||||||
|
"version" : "2.7.1",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Silk Browser",
|
"desc" : "Silk Browser",
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-84)",
|
"ua" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-84)",
|
||||||
@@ -978,6 +1158,26 @@
|
|||||||
"major" : "undefined"
|
"major" : "undefined"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Tesla",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/601.1 (KHTML, like Gecko) Tesla QtCarBrowser Safari/601.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Tesla",
|
||||||
|
"version" : "undefined",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Tesla",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/79.0.3945.130 Chrome/79.0.3945.130 Safari/537.36 Tesla/2020.16.2.1-e99c70fff409",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Tesla",
|
||||||
|
"version" : "2020.16.2.1-e99c70fff409",
|
||||||
|
"major" : "2020"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Tizen Browser",
|
"desc" : "Tizen Browser",
|
||||||
"ua" : "Mozilla/5.0 (Linux; U; Tizen/1.0 like Android; en-us; AppleWebKit/534.46 (KHTML, like Gecko) Tizen Browser/1.0 Mobile",
|
"ua" : "Mozilla/5.0 (Linux; U; Tizen/1.0 like Android; en-us; AppleWebKit/534.46 (KHTML, like Gecko) Tizen Browser/1.0 Mobile",
|
||||||
@@ -1048,6 +1248,16 @@
|
|||||||
"major" : "7"
|
"major" : "7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "UPBrowser",
|
||||||
|
"ua" : "BenQ-CF61/1.00/WAP2.0/MIDP2.0/CLDC1.0 UP.Browser/6.3.0.4.c.1.102 (GUI) MMP/2.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "UP.Browser",
|
||||||
|
"version" : "6.3.0.4.c.1.102",
|
||||||
|
"major" : "6"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc": "WeChat on iOS",
|
"desc": "WeChat on iOS",
|
||||||
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H321 MicroMessenger/6.3.6 NetType/WIFI Language/zh_CN",
|
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H321 MicroMessenger/6.3.6 NetType/WIFI Language/zh_CN",
|
||||||
@@ -1069,7 +1279,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc": "WeChat on Android",
|
"desc": "WeiBo on Android",
|
||||||
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16A366 Weibo (iPhone8,2__weibo__8.9.3__iphone__os12.0)",
|
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16A366 Weibo (iPhone8,2__weibo__8.9.3__iphone__os12.0)",
|
||||||
"expect":
|
"expect":
|
||||||
{
|
{
|
||||||
@@ -1088,6 +1298,16 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Viera",
|
||||||
|
"ua" : "HbbTV/1.2.1 (;Panasonic;VIERA 2015;3.014;a001-003 4000-0000;)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "VIERA",
|
||||||
|
"version" : "undefined",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Yandex",
|
"desc" : "Yandex",
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.5 (KHTML, like Gecko) YaBrowser/1.0.1084.5402 Chrome/19.0.1084.5402 Safari/536.5",
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.5 (KHTML, like Gecko) YaBrowser/1.0.1084.5402 Chrome/19.0.1084.5402 Safari/536.5",
|
||||||
@@ -1098,6 +1318,16 @@
|
|||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Yandex",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; arm_64; Android 11; M2101K7AG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.125 YaApp_Android/22.70 YaSearchBrowser/22.70 BroPP/1.0 SA/3 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Yandex",
|
||||||
|
"version" : "22.70",
|
||||||
|
"major" : "22"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Puffin",
|
"desc" : "Puffin",
|
||||||
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Lenovo P2a42 Build/MMB29M; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.8.15804AP",
|
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Lenovo P2a42 Build/MMB29M; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.8.15804AP",
|
||||||
@@ -1109,7 +1339,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Microsoft Edge",
|
"desc" : "Microsoft Edge 0.1",
|
||||||
"ua" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0",
|
"ua" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
@@ -1118,6 +1348,36 @@
|
|||||||
"major" : "12"
|
"major" : "12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Microsoft Edge 42",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Edge",
|
||||||
|
"version" : "17.17134",
|
||||||
|
"major" : "17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Microsoft Edge 44",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Edge",
|
||||||
|
"version" : "18.17763",
|
||||||
|
"major" : "18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Microsoft Edge 100",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.1108.55 Safari/537.36 Edg/100.0.1108.55",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Edge",
|
||||||
|
"version" : "100.0.1108.55",
|
||||||
|
"major" : "100"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Microsoft Edge on iOS",
|
"desc" : "Microsoft Edge on iOS",
|
||||||
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 EdgiOS/42.1.1.0 Mobile/15F79 Safari/605.1.15",
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 EdgiOS/42.1.1.0 Mobile/15F79 Safari/605.1.15",
|
||||||
@@ -1163,11 +1423,21 @@
|
|||||||
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) FxiOS/1.1 Mobile/13B143 Safari/601.1.46",
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) FxiOS/1.1 Mobile/13B143 Safari/601.1.46",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "Firefox",
|
"name" : "Mobile Firefox",
|
||||||
"version" : "1.1",
|
"version" : "1.1",
|
||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox iOS using iPad",
|
||||||
|
"ua" : "Mozilla/5.0 (iPad; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Firefox",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "QQ on iOS",
|
"desc" : "QQ on iOS",
|
||||||
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A456 QQ/6.5.3.410 V1_IPH_SQ_6.5.3_1_APP_A Pixel/1080 Core/UIWebView NetType/WIFI Mem/26",
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A456 QQ/6.5.3.410 V1_IPH_SQ_6.5.3_1_APP_A Pixel/1080 Core/UIWebView NetType/WIFI Mem/26",
|
||||||
@@ -1228,6 +1498,16 @@
|
|||||||
"major" : "4"
|
"major" : "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Supposed not to be detected as WeChat",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.124 Safari/537.36 qblink wegame.exe WeGame/5.1.1.11100 QBCore/3.70.107.400 QQBrowser/9.0.2524.400",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "QQBrowser",
|
||||||
|
"version" : "9.0.2524.400",
|
||||||
|
"major" : "9"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "GSA on iOS",
|
"desc" : "GSA on iOS",
|
||||||
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) GSA/30.1.161623614 Mobile/14F89 Safari/602.1",
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) GSA/30.1.161623614 Mobile/14F89 Safari/602.1",
|
||||||
@@ -1303,5 +1583,191 @@
|
|||||||
"version" : "2.6.90.14",
|
"version" : "2.6.90.14",
|
||||||
"major" : "2"
|
"major" : "2"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Electron",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Atom/1.41.0 Chrome/69.0.3497.128 Electron/4.2.7 Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Electron",
|
||||||
|
"version" : "4.2.7",
|
||||||
|
"major" : "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "IE11 on Windows 7 (ua length >255)",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64; APCPMS=^N201205020840572565478A37A6F9C41BD33F_9975^; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; MARKANYEPS#25118; Zoom 3.6.0; rv:11.0) like Gecko",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "IE",
|
||||||
|
"version" : "11.0",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LinkedIn",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [LinkedInApp]",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "LinkedIn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Safari including comma in minor version number",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Safari/605.1.15",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Safari",
|
||||||
|
"version" : "15.6,2",
|
||||||
|
"major" : "15"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mobile Safari including comma in minor version number",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Mobile/15E148 Safari/604.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Safari",
|
||||||
|
"version" : "15.6,2",
|
||||||
|
"major" : "15"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Cobalt 23 Master",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/23.master.0.0-devel (unlike Gecko) v8/8.8.278.8-jit gles Starboard/15",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "Cobalt",
|
||||||
|
"version": "23.0.0",
|
||||||
|
"major" : "23"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Cobalt 23 LTS",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/23.lts.1.0-qa (unlike Gecko) v8/8.8.278.8-jit gles Starboard/15",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "Cobalt",
|
||||||
|
"version": "23.1.0",
|
||||||
|
"major" : "23"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Cobalt 11",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/11.0-qa (unlike Gecko) Starboard/6",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "Cobalt",
|
||||||
|
"version": "11.0",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Cobalt 9",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/9.0-qa (unlike Gecko) Starboard/4",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "Cobalt",
|
||||||
|
"version": "9.0",
|
||||||
|
"major" : "9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KakaoTalk App Android",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 12; SM-G988N Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.79 Mobile Safari/537.36;KAKAOTALK 2409760",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "KAKAOTALK",
|
||||||
|
"version": "2409760",
|
||||||
|
"major" : "2409760"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KakaoStory App Android",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 12; SM-G988N Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.79 Mobile Safari/537.36 KAKAOSTORY/6.8.3_21046",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "KAKAOSTORY",
|
||||||
|
"version": "6.8.3_21046",
|
||||||
|
"major" : "6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KakaoTalk App iOS",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU; iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 BizWebView KAKAOTALK 9.7.6",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "KAKAOTALK",
|
||||||
|
"version": "9.7.6",
|
||||||
|
"major" : "9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Naver App Android",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 12; SM-G988N Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.232 Whale/1.0.0.0 Crosswalk/26.90.3.21 Mobile Safari/537.36 NAVER(inapp; search; 1010; 11.11.2)",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "NAVER",
|
||||||
|
"version": "11.11.2",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Naver App iOS",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/605.1 NAVER(inapp; search; 720; 10.25.0; 11PRO)",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "NAVER",
|
||||||
|
"version": "10.25.0",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "TikTok",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 11; 21061119AG Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.131 Mobile Safari/537.36 trill_2022109040 JsSdk/1.0 NetType/MOBILE Channel/googleplay AppName/musical_ly app_version/21.9.4 ByteLocale/ru-RU ByteFullLocale/ru-RU Region/KG BytedanceWebview/d8a21c6",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "TikTok",
|
||||||
|
"version": "21.9.4",
|
||||||
|
"major" : "21"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "TikTok",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 musical_ly_21.1.0 JsSdk/2.0 NetType/4G Channel/App Store ByteLocale/ru Region/RU ByteFullLocale/ru-RU isDarkMode/1 WKWebView/1 BytedanceWebview/d8a21c6",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "TikTok",
|
||||||
|
"version": "21.1.0",
|
||||||
|
"major" : "21"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "TikTok",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 10; STK-LX1 Build/HONORSTK-LX1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/110.0.5481.153 Mobile Safari/537.36 musical_ly_2022803040 JsSdk/1.0 NetType/WIFI Channel/huaweiadsglobal_int AppName/musical_ly app_version/28.3.4 ByteLocale/en ByteFullLocale/en Region/IQ Spark/1.2.7-alpha.8 AppVersion/28.3.4 PIA/1.5.11 BytedanceWebview/d8a21c6",
|
||||||
|
"expect" : {
|
||||||
|
"name" : "TikTok",
|
||||||
|
"version": "28.3.4",
|
||||||
|
"major" : "28"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Chrome Mobile",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5X Build/N2G47W) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Chrome",
|
||||||
|
"version" : "58.0.3029.83",
|
||||||
|
"major" : "58"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox Mobile",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5X Build/N2G47W) AppleWebKit/537.36 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Firefox",
|
||||||
|
"version" : "7.5b3349",
|
||||||
|
"major" : "7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Firefox Mobile",
|
||||||
|
"ua" : "Mozilla/5.0 (Android 5.0; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile Firefox",
|
||||||
|
"version" : "41.0",
|
||||||
|
"major" : "41"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -40,7 +40,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "ARMv6",
|
"desc" : "ARM",
|
||||||
|
"ua" : "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv61",
|
||||||
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
@@ -49,12 +57,76 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "ARMv7",
|
"desc" : "ARMv7",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux ARMv7) WebKitGTK+/3.4.9 vimprobable2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv7l",
|
||||||
|
"ua" : "Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebKit/537.42 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.42",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv7l",
|
||||||
"ua" : "Mozilla/5.0 (X11; CrOS armv7l 9765.85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.123 Safari/537.36",
|
"ua" : "Mozilla/5.0 (X11; CrOS armv7l 9765.85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.123 Safari/537.36",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"architecture" : "arm"
|
"architecture" : "arm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Nokia N900 Linux mobile",
|
||||||
|
"ua" : "Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0) Gecko/20100101 Firefox/10.0 Fennec/10.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMEABI",
|
||||||
|
"ua" : "[FBAN/FB4A;FBAV/237.0.0.44.120;FBBV/170693408;FBDM/{density=1.75,width=720,height=1280};FBLC/en_US;FBRV/172067074;FBCR/ ;FBMF/samsung;FBBD/samsung;FBPN/com.facebook.katana;FBDV/SM-S367VL;FBSV/9;FBBK/1;FBOP/19;FBCA/armeabi-v7a:armeabi;]",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv8",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Linux armv8l; rv:45.0) Gecko/20100101 Firefox/45.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AARCH64",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; CrOS aarch64 13310.93.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.133 Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARM64",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 10.0; ARM64; RM-1096) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARM64",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; arm_64; Android 9; HRY-LX1T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 YaBrowser/19.12.1.121.00 Mobile Safari/537.36",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm64"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Pocket PC",
|
"desc" : "Pocket PC",
|
||||||
"ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1",
|
"ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1",
|
||||||
@@ -87,6 +159,14 @@
|
|||||||
"architecture" : "ppc"
|
"architecture" : "ppc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac OS X on PowerPC using Firefox",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; PPC Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "UltraSPARC",
|
"desc" : "UltraSPARC",
|
||||||
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
||||||
@@ -95,6 +175,14 @@
|
|||||||
"architecture" : "sparc"
|
"architecture" : "sparc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "sparc64",
|
||||||
|
"ua" : "ELinks (0.4.3; NetBSD 3.0.2PATCH sparc64; 141x19)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "sparc64"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "QuickTime",
|
"desc" : "QuickTime",
|
||||||
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
||||||
@@ -110,5 +198,21 @@
|
|||||||
{
|
{
|
||||||
"architecture" : "amd64"
|
"architecture" : "amd64"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "IRIX64",
|
||||||
|
"ua" : "Mozilla/4.8C-SGI [en] (X11; U; IRIX64 6.5 IP27",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "irix64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "68k",
|
||||||
|
"ua" : "'Mozilla/1.1 (Macintosh; U; 68K)'",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "68k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,15 @@
|
|||||||
"version" : "12.0"
|
"version" : "12.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Flow",
|
||||||
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) EkiohFlow/5.7.4.30559 Flow/5.7.4 (like Gecko Firefox/53.0 rv:53.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Flow",
|
||||||
|
"version" : "5.7.4.30559"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Gecko",
|
"desc" : "Gecko",
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre",
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre",
|
||||||
@@ -44,6 +53,15 @@
|
|||||||
"version" : "4.5.4"
|
"version" : "4.5.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LibWeb",
|
||||||
|
"ua" : "Mozilla/4.0 (SerenityOS; x86) LibWeb+LibJS (Not KHTML, nor Gecko) LibWeb",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "LibWeb",
|
||||||
|
"version" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "NetFront",
|
"desc" : "NetFront",
|
||||||
"ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0",
|
"ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0",
|
||||||
@@ -97,5 +115,50 @@
|
|||||||
"name" : "WebKit",
|
"name" : "WebKit",
|
||||||
"version" : "537.36"
|
"version" : "537.36"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WebOS TV 5.x",
|
||||||
|
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Blink",
|
||||||
|
"version" : "68.0.3440.106"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WebOS TV 4.x",
|
||||||
|
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36 WebAppManager",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Blink",
|
||||||
|
"version" : "53.0.2785.34"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WebOS TV 3.x",
|
||||||
|
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Blink",
|
||||||
|
"version" : "38.0.2125.122"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WebOS TV 2.x",
|
||||||
|
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "WebKit",
|
||||||
|
"version" : "538.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WebOS TV 1.x",
|
||||||
|
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "WebKit",
|
||||||
|
"version" : "537.41"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
27
test/test-es6.mjs
Normal file
27
test/test-es6.mjs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { UAParser } from 'ua-parser-js';
|
||||||
|
import { CPUArch, DeviceType, EngineName } from 'ua-parser-js/enums';
|
||||||
|
import * as assert from 'assert';
|
||||||
|
|
||||||
|
describe('Returns', () => {
|
||||||
|
it('getResult() should returns object', () => {
|
||||||
|
assert.deepEqual(new UAParser('').getResult(),
|
||||||
|
{
|
||||||
|
ua : '',
|
||||||
|
//ua_ch : { architecture: undefined, bitness: undefined, brands: undefined, fullVersionList: undefined, mobile: false, model: undefined, platform: undefined, platformVersion: undefined },
|
||||||
|
browser: { name: undefined, version: undefined, major: undefined },
|
||||||
|
cpu: { architecture: undefined },
|
||||||
|
device: { vendor: undefined, model: undefined, type: undefined },
|
||||||
|
engine: { name: undefined, version: undefined},
|
||||||
|
os: { name: undefined, version: undefined }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Enums', () => {
|
||||||
|
it('Can use enum', () => {
|
||||||
|
const { cpu, device, engine } = UAParser('Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090928 Firefox/3.5 Maemo Browser 1.4.1.22 RX-51 N900');
|
||||||
|
assert.strictEqual(cpu.is(CPUArch.ARM), true);
|
||||||
|
assert.strictEqual(device.is(DeviceType.MOBILE), true);
|
||||||
|
assert.strictEqual(engine.is(EngineName.GECKO), true);
|
||||||
|
});
|
||||||
|
});
|
||||||
36
test/test-extension.js
Normal file
36
test/test-extension.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
const assert = require('assert');
|
||||||
|
const safeRegex = require('safe-regex');
|
||||||
|
const UAParser = require('ua-parser-js');
|
||||||
|
const { Bots, Emails, Tools } = require('ua-parser-js/extensions');
|
||||||
|
|
||||||
|
describe('Bots', () => {
|
||||||
|
it('Can detect bots', () => {
|
||||||
|
const googleBot = 'Googlebot-Video/1.0';
|
||||||
|
const msnBot = 'msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)';
|
||||||
|
const bingPreview = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b';
|
||||||
|
const opera = 'Opera/8.5 (Macintosh; PPC Mac OS X; U; en)';
|
||||||
|
const wget = 'Wget/1.21.1';
|
||||||
|
const facebookBot = 'Mozilla/5.0 (compatible; FacebookBot/1.0; +https://developers.facebook.com/docs/sharing/webmasters/facebookbot/)';
|
||||||
|
const outlook = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Microsoft Outlook 16.0.9126; Microsoft Outlook 16.0.9126; ms-office; MSOffice 16)';
|
||||||
|
const thunderbird = 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0';
|
||||||
|
|
||||||
|
const botParser = new UAParser(Bots);
|
||||||
|
assert.deepEqual(botParser.setUA(googleBot).getBrowser(), {name: "Googlebot-Video", version: "1.0", major: "1", type: "bot"});
|
||||||
|
assert.deepEqual(botParser.setUA(msnBot).getBrowser(), {name: "msnbot-media", version: "1.1", major: "1", type: "bot"});
|
||||||
|
assert.deepEqual(botParser.setUA(bingPreview).getBrowser(), {name: "BingPreview", version: "1.0b", major: "1", type: "bot"});
|
||||||
|
assert.deepEqual(botParser.setUA(opera).getBrowser(), {name: "Opera", version: "8.5", major: "8"});
|
||||||
|
|
||||||
|
// try merging Bots & Tools
|
||||||
|
const botsAndTools = { browser : [...Bots.browser, ...Tools.browser]};
|
||||||
|
const botolParser = new UAParser(botsAndTools);
|
||||||
|
assert.deepEqual(botolParser.setUA(wget).getBrowser(), {name: "Wget", version: "1.21.1", major: "1", type:"tool"});
|
||||||
|
assert.deepEqual(botolParser.setUA(facebookBot).getBrowser(), {name: "FacebookBot", version: "1.0", major: "1", type:"bot"});
|
||||||
|
|
||||||
|
const emailParser = new UAParser(Emails);
|
||||||
|
assert.deepEqual(emailParser.setUA(outlook).getBrowser(), {name: "Microsoft Outlook", version: "16.0.9126", major: "16", type: "email"});
|
||||||
|
assert.deepEqual(emailParser.setUA(thunderbird).getBrowser(), {name: "Thunderbird", version: "78.13.0", major: "78", type: "email"});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO : move test spec to JSON file
|
||||||
|
// TODO : check for safe-regex
|
||||||
342
test/test-extension.json
Normal file
342
test/test-extension.json
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
[{
|
||||||
|
"desc": "Essential PH-1",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 9; PH-1 Build/PPR1.180905.036) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Essential",
|
||||||
|
"model": "PH-1",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Gigaset Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Gigaset",
|
||||||
|
"model": "QV830",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "RCA Voyager III Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; RCT6973W43 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "RCA",
|
||||||
|
"model": "RCT6973W43",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "RCA Voyager II Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.0; RCT6773W22B Build/LRX21M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "RCA",
|
||||||
|
"model": "RCT6773W22B",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Verizon Quanta Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; QMV7B Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Verizon",
|
||||||
|
"model": "QMV7B",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Verizon Ellipsis 8 Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.1.1; QTAQZ3 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Verizon",
|
||||||
|
"model": "QTAQZ3",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Verizon Ellipsis 8HD Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; QTASUN1 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Verizon",
|
||||||
|
"model": "QTASUN1",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Dell Venue 8 Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 8 3830 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Dell",
|
||||||
|
"model": "Venue 8 3830",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Dell Venue 7 Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 7 3730 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Dell",
|
||||||
|
"model": "Venue 7 3730",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Barnes & Noble Nook HD+ Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Barnes & Noble Nook HD+ Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Barnes & Noble",
|
||||||
|
"model": "Nook HD+",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Barnes & Noble V400 Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Barnes & Noble",
|
||||||
|
"model": "V400",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "NuVision TM101A540N Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.1; TM101A540N Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "NuVision",
|
||||||
|
"model": "TM101A540N",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE-Z431",
|
||||||
|
"ua": "ZTE-Z431/1.4.0 NetFront/4.2 QTV5.1 Profile/MIDP-2.1 Configuration/CLDC-1.1",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "Z431",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; ZTE-Z740G Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "Z740G",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE K Series Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; K88 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "K88",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE Nubia Red Magic 3",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 9; NX629J Build/PKQ1.190321.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/45016 Mobile Safari/537.36 MMWEBID/4064 MicroMessenger/7.0.10.1580(0x27000A34) Process/tools NetType/WIFI Language/zh_CN ABI/arm64",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "NX629J",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE Blade A5",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 9; ZTE Blade A5 2019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "Blade A5 2019",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE BLADE V0730",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 6.0; ZTE BLADE V0730) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "BLADE V0730",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "ZTE B2017G",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 7.1.1; ZTE B2017G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "ZTE",
|
||||||
|
"model": "B2017G",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Swizz GEN610",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; GEN610 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Swiss",
|
||||||
|
"model": "GEN610",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Swizz ZUR700",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; ZUR700 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Swiss",
|
||||||
|
"model": "ZUR700",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Zeki TB782b Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-US; TB782B Build/IMM76D) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.0.2.299 U3/0.8.0 Mobile Safari/534.31",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Zeki",
|
||||||
|
"model": "TB782B",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Dragon Touch Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Dragon Touch",
|
||||||
|
"model": "9138B",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Insignia Tablet",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; NS-P08A7100 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Insignia",
|
||||||
|
"model": "NS-P08A7100",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Voice Xtreme V75",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; V75 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Voice",
|
||||||
|
"model": "V75",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "LvTel V11",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.1.1; V11 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "LvTel",
|
||||||
|
"model": "V11",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Envizen Tablet V100MD",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; V100MD Build/V100MD.20130816) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Envizen",
|
||||||
|
"model": "V100MD",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Rotor Tablet",
|
||||||
|
"ua": "mozilla/5.0 (linux; android 5.0.1; tu_1491 build/lrx22c) applewebkit/537.36 (khtml, like gecko) chrome/43.0.2357.93 safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Rotor",
|
||||||
|
"model": "1491",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "MachSpeed Tablets",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Trio 7.85 vQ Build/Trio_7.85_vQ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "MachSpeed",
|
||||||
|
"model": "Trio 7.85 vQ",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Trinity Tablets",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.0.1; Trinity T101 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Trinity",
|
||||||
|
"model": "T101",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "NextBook Next7",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Next7P12 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "NextBook",
|
||||||
|
"model": "Next7P12",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "NextBook Tablets",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.0; NXA8QC116 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "NextBook",
|
||||||
|
"model": "NXA8QC116",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Le Pan Tablets",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Le Pan",
|
||||||
|
"model": "TC802A",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Le Pan Tablets",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Le Pan",
|
||||||
|
"model": "TC802A",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "AT&T Radiant Core U304AA",
|
||||||
|
"ua": "Dalvik/2.1.0 (Linux; U; Android 9; U304AA Build/P00610)",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "AT&T",
|
||||||
|
"model": "U304AA",
|
||||||
|
"type": "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Vodafone Smart Tab 4G",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.4; Vodafone Smart Tab 4G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Vodafone",
|
||||||
|
"model": "Smart Tab 4G",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Vodafone Smart ultra 6",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 5.0.2; Vodafone Smart ultra 6 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.133 Mobile Safari/537.36",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "Vodafone",
|
||||||
|
"model": "Smart ultra 6",
|
||||||
|
"type": "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "4ife 4K Smart TV Box",
|
||||||
|
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; 4ife 4K Smart TV Box Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36 Vinebre",
|
||||||
|
"expect": {
|
||||||
|
"vendor": "undefined",
|
||||||
|
"model": "undefined",
|
||||||
|
"type": "smarttv"
|
||||||
|
}
|
||||||
|
}]
|
||||||
485
test/test.js
485
test/test.js
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user