Skip to content

Commit d8c81c5

Browse files
committed
Update with latest version 2.0.6
1 parent c5ad583 commit d8c81c5

File tree

7 files changed

+62
-17
lines changed

7 files changed

+62
-17
lines changed

docs/.vitepress/config.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineConfig({
2828
nav: [
2929
{ text: 'Home', link: '/' },
3030
{
31-
text: '2.0.5',
31+
text: '2.0.6',
3232
items: [
3333
{
3434
text: 'Changelog',
@@ -177,16 +177,38 @@ export default defineConfig({
177177
link: '/api/submodules/helpers/overview',
178178
collapsed: false,
179179
items: [
180-
{ text: 'getDeviceVendor()', link: '/api/submodules/helpers/get-device-vendor' },
181-
{ text: 'isAIBot()', link: '/api/submodules/helpers/is-ai-bot' },
182-
{ text: 'isAppleSilicon()', link: '/api/submodules/helpers/is-apple-silicon' },
183-
{ text: 'isBot()', link: '/api/submodules/helpers/is-bot' },
180+
{ text: 'isFrozenUA()', link: '/api/submodules/helpers/is-frozen-ua' }
181+
]
182+
},
183+
{
184+
text: 'BotDetection',
185+
link: '',
186+
collapsed: false,
187+
items: [
188+
{ text: 'isAIAssistant()', link: '' },
189+
{ text: 'isAICrawler()', link: '/api/submodules/helpers/is-ai-bot' },
190+
{ text: 'isBot()', link: '/api/submodules/helpers/is-bot' }
191+
]
192+
},
193+
{
194+
text: 'BrowserDetection',
195+
link: '',
196+
collapsed: false,
197+
items: [
184198
{ text: 'isChromeFamily()', link: '/api/submodules/helpers/is-chrome-family' },
185199
{ text: 'isElectron()', link: '/api/submodules/helpers/is-electron' },
186200
{ text: 'isFromEU()', link: '/api/submodules/helpers/is-from-eu' },
187-
{ text: 'isFrozenUA()', link: '/api/submodules/helpers/is-frozen-ua' },
188201
{ text: 'isStandalonePWA()', link: '/api/submodules/helpers/is-standalone-pwa' }
189202
]
203+
},
204+
{
205+
text: 'DeviceDetection',
206+
link: '',
207+
collapsed: false,
208+
items: [
209+
{ text: 'isAppleSilicon()', link: '/api/submodules/helpers/is-apple-silicon' },
210+
{ text: 'getDeviceVendor()', link: '/api/submodules/helpers/get-device-vendor' },
211+
]
190212
}
191213
]
192214
},

docs/api/main/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ UAParser(uastring?: string, extensions?: UAParserExt, headers?: UAParserHeaders)
1111
- In Node.js environment, you need to pass the User-Agent string manually, usually from `request.headers["user-agent"]`.
1212
:::
1313

14+
::: warning
15+
To ensure stable parsing performance and mitigate ReDoS attacks, User-Agent string longer than 500 chars will be automatically trimmed.
16+
:::
17+
1418
- `new UAParser()`
1519

1620
When called *with* the `new` keyword, it will return a new instance of `UAParser`.

docs/guides/articles-references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* [History of the browser user-agent string🡭](https://webaim.org/blog/user-agent-string-history/) *—Aaron Andersen*
55
* [The problem with User-Agent strings🡭](https://nielsleenheer.com/articles/2024/the-problem-with-user-agent-strings/) *—Niels Leenheer*
66
* [All You Need to Know About Browser's User Agent String🡭](https://dev.to/saadnoorsalehin/all-you-need-to-know-about-browser-s-user-agent-string-5fe6) *—Saadnoor Salehin*
7-
* [Automatically Personalize E-Learning with User Agent](https://charlesofalltrades.com/blog/automatically-adjust-your-e-learning-based-on-os/) *—Charles Palmer*
7+
* [Automatically Personalize E-Learning with User Agent🡭](https://charlesofalltrades.com/blog/automatically-adjust-your-e-learning-based-on-os/) *—Charles Palmer*
88
* [Building a Modern ReactJS App to Detect Browser and Device Details🡭](https://codewithghazi.substack.com/p/building-a-modern-reactjs-app-to) *—Ghazi Khan*
99
* [Determining User Device Type (Mobile or Desktop) in a Node.js Environment🡭](https://levelup.gitconnected.com/determining-user-device-type-mobile-or-desktop-in-a-node-js-environment-e8870bc8f3ea) *—Hongji Li*
1010
* [Device Detection with User Agent Strings🡭](https://www.aworkinprogress.dev/device-detection-with-ua-strings) *—Gao Wei*

docs/guides/how-to-detect-ios-26-using-javascript.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Starting with Safari on iOS 26, you can no longer rely on the User-Agent string
55
- [Safari on iOS/iPadOS/visionOS 26: "user agent string no longer lists the current version of the operating system"🡭](https://webkit.org/blog/17333/webkit-features-in-safari-26-0/#update-to-ua-string) *—Webkit Blog*
66

77
::: info
8-
Example User-Agent string on iOS 18.6:
8+
An example of User-Agent string on iOS 18.6:
99

1010
`Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1`
1111

@@ -16,21 +16,22 @@ Meanwhile the User-Agent string on iOS 26:
1616

1717
---
1818

19-
In the meantime, a temporary workaround would be like this:
19+
::: tip
20+
Since UAParser.js version `2.0.6`, the iOS version will be correctly detected as `26.x` instead of `18.6`. Whereas for version `2.0.5` and below, you can use a _temporary workaround_ like this:
2021

2122
```js
2223
import { UAParser } from 'ua-parser-js';
2324
import { BrowserName, OSName } from 'ua-parser-js/enums';
2425

2526
function getiOSVersion (ua) {
2627
const { browser, os } = UAParser(ua);
27-
if (browser.name == BrowserName.SAFARI_MOBILE &&
28-
browser.major == '26' &&
29-
os.name == OSName.IOS &&
30-
os.version == '18.6') {
31-
return '26';
28+
if (browser.name == BrowserName.SAFARI_MOBILE &&
29+
browser.major == '26' &&
30+
os.name == OSName.IOS &&
31+
os.version == '18.6') {
32+
return '26';
3233
} else {
33-
return os.version;
34+
return os.version;
3435
}
3536
}
3637

@@ -39,4 +40,5 @@ const safari26 = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWe
3940

4041
console.log(getiOSVersion(safari18)); // 18.6
4142
console.log(getiOSVersion(safari26)); // 26
42-
```
43+
```
44+
:::

docs/info/browser/name.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Here is a list of possible values for `browser.name`:
1414
- [`AVG Secure Browser`](./name/avg.md)
1515
- [`Baidu Browser`](./name/baidu.md)
1616
- [`Basilisk`](./name/basilisk.md)
17+
- `Bing`
1718
- [`Blazer`](./name/blazer.md)
1819
- [`Bolt`](./name/bolt.md)
1920
- [`Brave`](./name/brave.md)
@@ -119,6 +120,7 @@ Here is a list of possible values for `browser.name`:
119120
- [`Quark`](./name/quark.md)
120121
- [`QupZilla`](./name/qupzilla.md)
121122
- `qutebrowser`
123+
- `Qwant`
122124
- [`Rekonq`](./name/rekonq.md)
123125
- [`RockMelt`](./name/rockmelt.md)
124126
- [`Safari`](./name/safari.md)

docs/info/device/vendor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Here is a list of possible values for `device.vendor`:
2222
- `GeeksPhone`
2323
- `Generic`
2424
- `Google`
25+
- `Hisense`
2526
- `HMD`
2627
- `Honor`
2728
- `HP`
@@ -71,6 +72,7 @@ Here is a list of possible values for `device.vendor`:
7172
- `Vizio`
7273
- `Vivo`
7374
- `Vodafone`
75+
- `Wiko`
7476
- `Xbox`
7577
- `Xiaomi`
7678
- `Zebra`

docs/intro/quick-start/using-cli.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,17 @@ npx ua-parser-js "Flock/2.16 (Zenwalk 7.3; es_PR;)"
3333

3434
# let's save the result into a log file:
3535
npx ua-parser-js "Flock/2.16 (Zenwalk 7.3; es_PR;)" >> log.txt
36-
```
36+
```
37+
38+
## Processing Batch User-Agent Data from File
39+
40+
You can also parse multiple User-Agent strings from a file and exporting the results as JSON. This is useful for bulk analysis, log processing, or offline User-Agent parsing.
41+
42+
```sh [Console ~vscode-icons:file-type-shell~]
43+
npx ua-parser-js --input-file log.txt --output-file log-result.json
44+
```
45+
46+
**Options:**
47+
48+
* `--input-file` : path to a text file containing User-Agent strings (one per line).
49+
* `--output-file` : path to the JSON file where parsed results will be saved.

0 commit comments

Comments
 (0)