ua-parser-js 0.7.37 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ua-parser-js might be problematic. Click here for more details.

package/readme.md CHANGED
@@ -15,106 +15,40 @@
15
15
  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).
16
16
 
17
17
  * Author : Faisal Salman <<f@faisalman.com>>
18
- * Demo : https://faisalman.github.io/ua-parser-js
18
+ * Demo : http://faisalman.github.io/ua-parser-js
19
19
  * Source : https://github.com/faisalman/ua-parser-js
20
- * Documentation :
21
- * v1 : https://github.com/faisalman/ua-parser-js/tree/1.0.35#documentation
22
- * v2 : https://faisalman.github.io/ua-parser-js-docs/v2
23
-
24
- ***
25
-
26
- ### From Our Sponsors:
27
- <table>
28
- <thead>
29
- </thead>
30
- <tbody>
31
- <tr>
32
- <td colspan="2">
33
- <a href="https://opencollective.com/ua-parser-js">↗ Become a sponsor</a>
34
- </td>
35
- </tr>
36
- </tbody>
37
- </table>
38
-
39
- ---
40
20
 
41
21
  # Documentation
42
- ### UAParser([user-agent][,extensions])
43
- typeof `user-agent` "string".
44
-
45
- typeof `extensions` "array".
46
-
47
- 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.
48
- Usually you can find the user agent in:
49
- `request.headers["user-agent"]`.
50
-
51
22
 
52
23
  ## Constructor
53
- 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.
54
- Like so:
24
+
55
25
  * `new UAParser([uastring][,extensions])`
56
- ```js
57
- let parser = new UAParser("user-agent"); // you need to pass the user-agent for nodejs
58
- console.log(parser); // {}
59
- let parserResults = parser.getResult();
60
- console.log(parserResults);
61
- /** {
62
- "ua": "",
63
- "browser": {},
64
- "engine": {},
65
- "os": {},
66
- "device": {},
67
- "cpu": {}
68
- } */
69
- ```
26
+ * returns new instance
70
27
 
71
- When you call UAParser without the `new` keyword, it will automatically call `getResult()` function and return the parsed results.
72
28
  * `UAParser([uastring][,extensions])`
73
29
  * returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
74
30
 
75
31
  ## Methods
76
32
 
77
- #### Methods table
78
- The methods are self explanatory, here's a small overview on all the available methods:
79
- * `getResult()` - returns all function object calls, user-agent string, browser info, cpu, device, engine, os:
80
- `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`.
81
-
82
- * `getBrowser()` - returns the browser name and version.
83
- * `getDevice()` - returns the device model, type, vendor.
84
- * `getEngine()` - returns the current browser engine name and version.
85
- * `getOS()` - returns the running operating system name and version.
86
- * `getCPU()` - returns CPU architectural design name.
87
- * `getUA()` - returns the user-agent string.
88
- * `setUA(user-agent)` - set a custom user-agent to be parsed.
89
-
90
-
91
- ---
92
-
93
- * `getResult()`
94
- * returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
95
-
96
33
  * `getBrowser()`
97
34
  * returns `{ name: '', version: '' }`
98
35
 
99
36
  ```sh
100
37
  # Possible 'browser.name':
101
- 2345Explorer, 360 Browser, Alipay, Amaya, Android Browser, Arora, Avant, Avast,
102
- AVG, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
103
- Chrome Headless, Chrome WebView, Chrome, Chromium, Cobalt, Comodo Dragon, Dillo,
104
- Dolphin, Doris, DuckDuckGo, Edge, Electron, Epiphany, Facebook, Falkon, Fennec,
105
- Firebird, Firefox [Focus/Reality], Flock, Flow, GSA, GoBrowser, Heytap,
106
- Huawei Browser, iCab, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon,
107
- Iceweasel, Instagram, Iridium, Iron, Jasmine, Kakao[Story/Talk], K-Meleon,
108
- Kindle, Klar, Klarna, Konqueror, LBBROWSER, Line, LinkedIn, Links, Lunascape,
109
- Lynx, MIUI Browser, Maemo, Maxthon, Midori, Minimo, Mobile Safari, Mosaic,
110
- Mozilla, NetFront, NetSurf, Netfront, Netscape, NokiaBrowser, Obigo,
111
- Oculus Browser, OmniWeb, Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon,
112
- PhantomJS, Phoenix, Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark,
113
- QupZilla, RockMelt, Safari, Sailfish Browser, Samsung Internet, SeaMonkey, Silk,
114
- Skyfire, Sleipnir, Slim, SlimBrowser, Smart Lenovo Browser, Snapchat,
115
- Sogou [Explorer/Mobile], Swiftfox, Tesla, TikTok, Tizen Browser, UCBrowser,
116
- UP.Browser, Viera, Vivaldi, Vivo Browser, Waterfox, WeChat, Weibo, Yandex, w3m,
117
- Whale Browser, ...
38
+ 2345Explorer, 360 Browser, Amaya, Android Browser, Arora, Avant, Avast, AVG,
39
+ BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
40
+ Chrome Headless, Chrome WebView, Chrome, Chromium, Comodo Dragon, Dillo,
41
+ Dolphin, Doris, Edge, Electron, Epiphany, Facebook, Falkon, Fennec, Firebird,
42
+ Firefox [Reality], Flock, Flow, GSA, GoBrowser, ICE Browser, IE, IEMobile, IceApe,
43
+ IceCat, IceDragon, Iceweasel, Instagram, Iridium, Iron, Jasmine, K-Meleon,
44
+ Kindle, Konqueror, LBBROWSER, Line, Links, Lunascape, Lynx, MIUI Browser,
45
+ Maemo Browser, Maemo, Maxthon, MetaSr Midori, Minimo, Mobile Safari, Mosaic,
46
+ Mozilla, NetFront, NetSurf, Netfront, Netscape, NokiaBrowser, Oculus Browser,
47
+ OmniWeb, Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix,
48
+ Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, Safari,
49
+ Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim,
50
+ SlimBrowser, Swiftfox, Tesla, Tizen Browser, UCBrowser, Vivaldi, Waterfox, WeChat,
51
+ Weibo, Yandex, baidu, iCab, w3m, Whale Browser...
118
52
 
119
53
  # 'browser.version' determined dynamically
120
54
  ```
@@ -126,20 +60,12 @@ Whale Browser, ...
126
60
  # Possible 'device.type':
127
61
  console, mobile, tablet, smarttv, wearable, embedded
128
62
 
129
- ##########
130
- # NOTE: 'desktop' is not a possible device type.
131
- # UAParser only reports info directly available from the UA string, which is not the case for 'desktop' device type.
132
- # If you wish to detect desktop devices, you must handle the needed logic yourself.
133
- # You can read more about it in this issue: https://github.com/faisalman/ua-parser-js/issues/182
134
- ##########
135
-
136
63
  # Possible 'device.vendor':
137
64
  Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
138
- Essential, Facebook, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Infinix,
139
- Jolla, Kobo, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia,
140
- Nvidia, OnePlus, OPPO, Ouya, Palm, Panasonic, Pebble, Polytron, Realme, RIM,
141
- Roku, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Tecno, Tesla, Ulefone,
142
- Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
65
+ Essential, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG,
66
+ Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
67
+ Palm, Panasonic, Pebble, Polytron, Realme, RIM, Samsung, Sharp, Siemens,
68
+ Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
143
69
 
144
70
  # 'device.model' determined dynamically
145
71
  ```
@@ -149,8 +75,8 @@ Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
149
75
 
150
76
  ```sh
151
77
  # Possible 'engine.name'
152
- Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, LibWeb, Links, Lynx,
153
- NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
78
+ Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, Links, Lynx, NetFront,
79
+ NetSurf, Presto, Tasman, Trident, w3m, WebKit
154
80
 
155
81
  # 'engine.version' determined dynamically
156
82
  ```
@@ -160,15 +86,13 @@ NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
160
86
 
161
87
  ```sh
162
88
  # Possible 'os.name'
163
- AIX, Amiga OS, Android[-x86], Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
164
- Contiki, Fedora, Firefox OS, FreeBSD, Debian, Deepin, DragonFly, elementary OS,
165
- Fuchsia, Gentoo, GhostBSD, GNU, Haiku, HarmonyOS, HP-UX, Hurd, iOS, Joli, KaiOS,
166
- Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
167
- Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
168
- PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
169
- RISC OS, Sabayon, Sailfish, SerenityOS, Series40, Slackware, Solaris, SUSE,
170
- Symbian, Tizen, Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS,
171
- Windows [Phone/Mobile], Zenwalk, ...
89
+ AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
90
+ Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Fuchsia, Gentoo, GNU,
91
+ Haiku, Hurd, iOS, Joli, KaiOS, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo,
92
+ Minix, Mint, Morph OS, NetBSD, Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD,
93
+ PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS, RISC OS,
94
+ Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, Unix,
95
+ VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk, ...
172
96
 
173
97
  # 'os.version' determined dynamically
174
98
  ```
@@ -178,10 +102,12 @@ Windows [Phone/Mobile], Zenwalk, ...
178
102
 
179
103
  ```sh
180
104
  # Possible 'cpu.architecture'
181
- 68k, amd64, arm[64/hf], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc,
182
- sparc[64]
105
+ 68k, amd64, arm[64/hf], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64]
183
106
  ```
184
107
 
108
+ * `getResult()`
109
+ * returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
110
+
185
111
  * `getUA()`
186
112
  * returns UA string of current instance
187
113
 
@@ -265,8 +191,6 @@ sparc[64]
265
191
 
266
192
  ## Using node.js
267
193
 
268
- Note: Device information is not available in the NodeJS environment.
269
-
270
194
  ```sh
271
195
  $ npm install ua-parser-js
272
196
  ```
@@ -337,10 +261,9 @@ console.log(myParser.setUA(myUA).getBrowser()); // {name: "MyBrowser", version:
337
261
 
338
262
  # Development
339
263
 
340
- ## Backers & Sponsors
264
+ ## Sponsors
341
265
 
342
- <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a>
343
- <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a>
266
+ <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>
344
267
 
345
268
  <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>
346
269