ua-browser 1.2.0 → 1.3.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.
- package/README.md +48 -24
- package/README.zh-CN.md +49 -25
- package/dist/index.cjs +2 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -38
- package/dist/index.d.ts +2 -38
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +3 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
|
|
8
|
-
Detect browser, OS, device type, rendering engine, CPU architecture, bots,
|
|
8
|
+
Detect browser, OS, device type, rendering engine, CPU architecture, bots, headless browsers, and Mini Programs from User Agent strings. Zero dependencies. Works in both browser and Node.js environments.
|
|
9
9
|
|
|
10
10
|
**[📖 Documentation](https://yangtianxia.github.io/ua-browser/)** · **[🎮 Playground](https://yangtianxia.github.io/ua-browser/playground)** · **[中文](./README.zh-CN.md)**
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **Comprehensive detection** — browser, OS, engine, device type (Mobile / Tablet / TV / PC), CPU arch, bots, headless browsers
|
|
14
|
+
- **Comprehensive UA detection** — browser, OS, engine, device type (Mobile / Tablet / TV / PC), CPU arch, bots, headless browsers
|
|
15
|
+
- **Multi-signal arch detection** — `getEnvContext()` collects Client Hints, WebGL renderer, and font probes to accurately distinguish Apple Silicon from Intel Mac
|
|
16
|
+
- **SSR Client Hints** — `parseHeaders()` + `ACCEPT_CH` for precise server-side detection (CPU arch, platform) in Chrome / Edge 90+
|
|
15
17
|
- **AI bot recognition** — built-in support for GPTBot, ClaudeBot, PerplexityBot, CCBot and more
|
|
16
18
|
- **Zero dependencies** — no runtime dependencies, tiny bundle size after gzip
|
|
17
19
|
- **Pure function** — `parseUA()` has no global state, works seamlessly with SSR / Node.js
|
|
@@ -67,16 +69,10 @@ const { browser, os, device } = uaBrowser()
|
|
|
67
69
|
if (device === 'Mobile') {
|
|
68
70
|
// redirect to mobile version
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
if (browser === 'Wechat') {
|
|
72
|
-
// WeChat in-app browser logic
|
|
73
|
-
}
|
|
74
72
|
```
|
|
75
73
|
|
|
76
74
|
### Node.js / SSR
|
|
77
75
|
|
|
78
|
-
Use the pure `parseUA` function with the UA string from the request header:
|
|
79
|
-
|
|
80
76
|
```typescript
|
|
81
77
|
import { parseUA } from 'ua-browser'
|
|
82
78
|
|
|
@@ -97,6 +93,34 @@ if (isBot) {
|
|
|
97
93
|
</script>
|
|
98
94
|
```
|
|
99
95
|
|
|
96
|
+
### Multi-signal Architecture Detection
|
|
97
|
+
|
|
98
|
+
`getEnvContext()` collects Client Hints, WebGL renderer, and other browser signals in one async call — enough to distinguish Apple Silicon from Intel Mac:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { getEnvContext, parseUA } from 'ua-browser'
|
|
102
|
+
|
|
103
|
+
const ctx = await getEnvContext()
|
|
104
|
+
const result = parseUA(navigator.userAgent, { ctx })
|
|
105
|
+
|
|
106
|
+
console.log(result.arch) // 'arm64' or 'x86_64'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### SSR Client Hints
|
|
110
|
+
|
|
111
|
+
Set the `ACCEPT_CH` response header so Chrome / Edge 90+ browsers send Client Hints on subsequent requests, then use `parseHeaders` for precise server-side detection:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { parseHeaders, ACCEPT_CH } from 'ua-browser'
|
|
115
|
+
|
|
116
|
+
// First response — tell the browser to send Client Hints
|
|
117
|
+
res.setHeader('Accept-CH', ACCEPT_CH)
|
|
118
|
+
|
|
119
|
+
// Subsequent requests — accurate arch / OS detection
|
|
120
|
+
const result = parseHeaders(req.headers)
|
|
121
|
+
console.log(result.arch) // 'x86_64' (from Sec-CH-UA-Arch)
|
|
122
|
+
```
|
|
123
|
+
|
|
100
124
|
### Accurate Windows 10 / 11 Detection
|
|
101
125
|
|
|
102
126
|
Windows 10 and 11 share the same UA string. Use the Client Hints API to distinguish them:
|
|
@@ -118,8 +142,6 @@ console.log(result.osVersion) // '10' or '11'
|
|
|
118
142
|
Automatically injects the `navigator` context (language, platform, MIME types, etc.) in browser environments.
|
|
119
143
|
|
|
120
144
|
```typescript
|
|
121
|
-
import uaBrowser from 'ua-browser'
|
|
122
|
-
|
|
123
145
|
uaBrowser() // reads navigator.userAgent automatically
|
|
124
146
|
uaBrowser(customUA) // custom UA string, still injects browser context
|
|
125
147
|
```
|
|
@@ -128,16 +150,18 @@ uaBrowser(customUA) // custom UA string, still injects browser context
|
|
|
128
150
|
|
|
129
151
|
```typescript
|
|
130
152
|
import {
|
|
131
|
-
parseUA,
|
|
132
|
-
getNavContext,
|
|
133
|
-
getWindowsVersion,
|
|
134
|
-
getLanguage,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
parseUA, // pure function, ideal for SSR / Node.js
|
|
154
|
+
getNavContext, // read current browser navigator context
|
|
155
|
+
getWindowsVersion, // async: accurately distinguish Windows 10 / 11
|
|
156
|
+
getLanguage, // extract browser language from NavContext
|
|
157
|
+
getEnvContext, // collect all browser signals (Client Hints, WebGL, etc.)
|
|
158
|
+
parseHeaders, // parse UA and Client Hints from HTTP headers (SSR)
|
|
159
|
+
ACCEPT_CH, // response header constant to request Client Hints
|
|
160
|
+
isWebview, // detect Android Webview / iOS WKWebView
|
|
161
|
+
detectBot, // standalone bot detection
|
|
162
|
+
detectArch, // standalone CPU architecture detection
|
|
163
|
+
detectHeadless, // standalone headless browser detection
|
|
164
|
+
VERSION, // current library version
|
|
141
165
|
} from 'ua-browser'
|
|
142
166
|
```
|
|
143
167
|
|
|
@@ -152,7 +176,7 @@ import {
|
|
|
152
176
|
| `osVersion` | `string` | OS version |
|
|
153
177
|
| `device` | `DeviceName` | Device type: `Mobile` \| `Tablet` \| `TV` \| `PC` |
|
|
154
178
|
| `arch` | `ArchName` | CPU architecture |
|
|
155
|
-
| `isWebview` | `boolean` | Whether running in Android Webview |
|
|
179
|
+
| `isWebview` | `boolean` | Whether running in Android Webview or iOS WKWebView |
|
|
156
180
|
| `isHeadless` | `boolean` | Whether running in a headless / automated browser |
|
|
157
181
|
| `isBot` | `boolean` | Whether the UA belongs to a bot / crawler |
|
|
158
182
|
| `botName` | `BotName` | Bot name |
|
|
@@ -163,11 +187,11 @@ import {
|
|
|
163
187
|
|
|
164
188
|
## Supported
|
|
165
189
|
|
|
166
|
-
Over
|
|
190
|
+
Over 70 browsers, 17 operating systems, and 19 bot rules built in. See the **[full support list](https://yangtianxia.github.io/ua-browser/guide/support-list)**.
|
|
167
191
|
|
|
168
192
|
Highlights:
|
|
169
|
-
- **Browsers** — Chrome, Safari, Firefox, Edge, Samsung Internet, UC, WeChat, DingTalk, TikTok and more
|
|
170
|
-
- **OS** — Windows, macOS, Android, iOS, HarmonyOS, Tizen, KaiOS and more
|
|
193
|
+
- **Browsers** — Chrome, Safari, Firefox, Edge, Samsung Internet, UC, WeChat, DingTalk, TikTok, Bilibili, Kuaishou, Xiaohongshu, Feishu and more
|
|
194
|
+
- **OS** — Windows, macOS, Android, iOS, HarmonyOS, OpenHarmony, Tizen, KaiOS and more
|
|
171
195
|
- **AI bots** — GPTBot, ClaudeBot, PerplexityBot, CCBot and more
|
|
172
196
|
- **Devices** — Mobile, Tablet, TV (Samsung Smart TV, HbbTV), PC
|
|
173
197
|
|
package/README.zh-CN.md
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
|
|
8
|
-
通过 User Agent 检测浏览器、操作系统、设备类型、渲染内核、CPU
|
|
8
|
+
通过 User Agent 检测浏览器、操作系统、设备类型、渲染内核、CPU 架构、爬虫、无头浏览器及小程序运行环境。零依赖,支持浏览器与 Node.js 双环境。
|
|
9
9
|
|
|
10
10
|
**[📖 文档](https://yangtianxia.github.io/ua-browser/)** · **[🎮 Playground](https://yangtianxia.github.io/ua-browser/playground)** · **[English](./README.md)**
|
|
11
11
|
|
|
12
12
|
## 特性
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
14
|
+
- **全面 UA 检测** — 浏览器、OS、渲染内核、设备类型(Mobile / Tablet / TV / PC)、CPU 架构、爬虫、无头浏览器
|
|
15
|
+
- **多信号架构检测** — `getEnvContext()` 采集 Client Hints、WebGL 渲染器、字体探针,精确区分 Apple Silicon 与 Intel Mac
|
|
16
|
+
- **SSR Client Hints** — `parseHeaders()` + `ACCEPT_CH`,在 Chrome / Edge 90+ 中实现服务端精准检测(CPU 架构、平台等)
|
|
17
|
+
- **AI 爬虫识别** — 内置 GPTBot、ClaudeBot、PerplexityBot、CCBot 等主流 AI 抓取机器人
|
|
16
18
|
- **零依赖** — 无任何运行时依赖,gzip 后体积极小
|
|
17
19
|
- **纯函数** — `parseUA()` 无全局状态,天然支持 SSR / Node.js
|
|
18
20
|
- **TypeScript** — 完整类型定义,`BrowserName`、`OsName` 等均为精确字面量联合类型
|
|
@@ -67,16 +69,10 @@ const { browser, os, device } = uaBrowser()
|
|
|
67
69
|
if (device === 'Mobile') {
|
|
68
70
|
// 跳转移动版
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
if (browser === 'Wechat') {
|
|
72
|
-
// 微信内置浏览器逻辑
|
|
73
|
-
}
|
|
74
72
|
```
|
|
75
73
|
|
|
76
74
|
### Node.js / SSR
|
|
77
75
|
|
|
78
|
-
使用 `parseUA` 纯函数,传入请求头中的 UA 字符串:
|
|
79
|
-
|
|
80
76
|
```typescript
|
|
81
77
|
import { parseUA } from 'ua-browser'
|
|
82
78
|
|
|
@@ -97,6 +93,34 @@ if (isBot) {
|
|
|
97
93
|
</script>
|
|
98
94
|
```
|
|
99
95
|
|
|
96
|
+
### 多信号架构检测
|
|
97
|
+
|
|
98
|
+
`getEnvContext()` 一次性采集 Client Hints、WebGL 渲染器等多维信号,可区分 Apple Silicon 与 Intel Mac:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { getEnvContext, parseUA } from 'ua-browser'
|
|
102
|
+
|
|
103
|
+
const ctx = await getEnvContext()
|
|
104
|
+
const result = parseUA(navigator.userAgent, { ctx })
|
|
105
|
+
|
|
106
|
+
console.log(result.arch) // 'arm64' 或 'x86_64'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### SSR Client Hints
|
|
110
|
+
|
|
111
|
+
通过响应头告知 Chrome / Edge 90+ 上报 Client Hints,再用 `parseHeaders` 在服务端精准解析:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { parseHeaders, ACCEPT_CH } from 'ua-browser'
|
|
115
|
+
|
|
116
|
+
// 第一次响应时写入 Accept-CH
|
|
117
|
+
res.setHeader('Accept-CH', ACCEPT_CH)
|
|
118
|
+
|
|
119
|
+
// 后续请求携带 Client Hints 后,精准识别架构等信息
|
|
120
|
+
const result = parseHeaders(req.headers)
|
|
121
|
+
console.log(result.arch) // 'x86_64'(来自 Sec-CH-UA-Arch)
|
|
122
|
+
```
|
|
123
|
+
|
|
100
124
|
### 精确区分 Windows 10 / 11
|
|
101
125
|
|
|
102
126
|
Windows 10 和 11 的 UA 字符串相同,需借助 Client Hints API 异步获取:
|
|
@@ -118,8 +142,6 @@ console.log(result.osVersion) // '10' 或 '11'
|
|
|
118
142
|
在浏览器环境中自动注入 `navigator` 上下文(语言、平台、MIME 类型等)。
|
|
119
143
|
|
|
120
144
|
```typescript
|
|
121
|
-
import uaBrowser from 'ua-browser'
|
|
122
|
-
|
|
123
145
|
uaBrowser() // 自动读取 navigator.userAgent
|
|
124
146
|
uaBrowser(customUA) // 传入自定义 UA,仍注入当前浏览器上下文
|
|
125
147
|
```
|
|
@@ -128,16 +150,18 @@ uaBrowser(customUA) // 传入自定义 UA,仍注入当前浏览器上下文
|
|
|
128
150
|
|
|
129
151
|
```typescript
|
|
130
152
|
import {
|
|
131
|
-
parseUA,
|
|
132
|
-
getNavContext,
|
|
133
|
-
getWindowsVersion,
|
|
134
|
-
getLanguage,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
parseUA, // 纯函数,适合 SSR / Node.js
|
|
154
|
+
getNavContext, // 读取当前浏览器 navigator 上下文
|
|
155
|
+
getWindowsVersion, // 异步精确区分 Windows 10 / 11
|
|
156
|
+
getLanguage, // 从 NavContext 获取浏览器语言
|
|
157
|
+
getEnvContext, // 采集所有浏览器环境信号(Client Hints、WebGL 等)
|
|
158
|
+
parseHeaders, // 从 HTTP 请求头解析 UA 及 Client Hints(SSR)
|
|
159
|
+
ACCEPT_CH, // 响应头常量,告知浏览器上报 Client Hints
|
|
160
|
+
isWebview, // 检测 Android Webview / iOS WKWebView
|
|
161
|
+
detectBot, // 独立爬虫检测
|
|
162
|
+
detectArch, // 独立 CPU 架构检测
|
|
163
|
+
detectHeadless, // 独立无头浏览器检测
|
|
164
|
+
VERSION, // 当前版本号
|
|
141
165
|
} from 'ua-browser'
|
|
142
166
|
```
|
|
143
167
|
|
|
@@ -152,7 +176,7 @@ import {
|
|
|
152
176
|
| `osVersion` | `string` | 系统版本 |
|
|
153
177
|
| `device` | `DeviceName` | 设备类型:`Mobile` \| `Tablet` \| `TV` \| `PC` |
|
|
154
178
|
| `arch` | `ArchName` | CPU 架构 |
|
|
155
|
-
| `isWebview` | `boolean` | 是否为 Android Webview |
|
|
179
|
+
| `isWebview` | `boolean` | 是否为 Android Webview / iOS WKWebView |
|
|
156
180
|
| `isHeadless` | `boolean` | 是否为无头 / 自动化浏览器 |
|
|
157
181
|
| `isBot` | `boolean` | 是否为爬虫 / 机器人 |
|
|
158
182
|
| `botName` | `BotName` | 爬虫名称 |
|
|
@@ -163,11 +187,11 @@ import {
|
|
|
163
187
|
|
|
164
188
|
## 支持范围
|
|
165
189
|
|
|
166
|
-
内置超过
|
|
190
|
+
内置超过 70 种浏览器、17 种操作系统、19 种爬虫规则,详见 **[内置支持列表](https://yangtianxia.github.io/ua-browser/guide/support-list)**。
|
|
167
191
|
|
|
168
192
|
部分覆盖:
|
|
169
|
-
- **浏览器** — Chrome、Safari、Firefox、Edge、Samsung Internet、UC
|
|
170
|
-
- **操作系统** — Windows、macOS、Android、iOS、HarmonyOS、Tizen、KaiOS 等
|
|
193
|
+
- **浏览器** — Chrome、Safari、Firefox、Edge、Samsung Internet、UC、微信、钉钉、抖音、哔哩哔哩、快手、小红书、飞书等
|
|
194
|
+
- **操作系统** — Windows、macOS、Android、iOS、HarmonyOS、OpenHarmony、Tizen、KaiOS 等
|
|
171
195
|
- **AI 爬虫** — GPTBot、ClaudeBot、PerplexityBot、CCBot 等
|
|
172
196
|
- **设备** — Mobile、Tablet、TV(含三星 Smart TV、HbbTV 标准)、PC
|
|
173
197
|
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.3.0"};
|
|
8
8
|
|
|
9
9
|
// src/constants/browsers.ts
|
|
10
10
|
var BROWSER_DEFS = [
|
|
@@ -432,7 +432,7 @@ function getLanguage(nav) {
|
|
|
432
432
|
|
|
433
433
|
// src/parse.ts
|
|
434
434
|
function parseUA(ua, options = {}) {
|
|
435
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
435
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
436
436
|
const effectiveNav = (_a = options.ctx) != null ? _a : options.nav;
|
|
437
437
|
const effectiveWindowsVersion = (_c = (_b = options.ctx) == null ? void 0 : _b.windowsVersion) != null ? _c : options.windowsVersion;
|
|
438
438
|
const { browser: rawBrowser, version: rawVersion } = detectBrowser(ua);
|
|
@@ -497,54 +497,6 @@ function parseUA(ua, options = {}) {
|
|
|
497
497
|
} catch (e) {
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
if (browser === "Wechat") {
|
|
501
|
-
try {
|
|
502
|
-
if (typeof __wxjs_environment !== "undefined" && __wxjs_environment === "miniprogram") {
|
|
503
|
-
browser = "Wechat Miniapp";
|
|
504
|
-
}
|
|
505
|
-
} catch (e) {
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if (browser === "Alipay") {
|
|
509
|
-
try {
|
|
510
|
-
if (typeof window !== "undefined" && typeof ((_i = window.my) == null ? void 0 : _i.getSystemInfo) === "function") {
|
|
511
|
-
browser = "Alipay Miniapp";
|
|
512
|
-
}
|
|
513
|
-
} catch (e) {
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
if (browser === "Baidu") {
|
|
517
|
-
try {
|
|
518
|
-
if (typeof swan !== "undefined" && typeof (swan == null ? void 0 : swan.getSystemInfo) === "function") {
|
|
519
|
-
browser = "Baidu Miniapp";
|
|
520
|
-
}
|
|
521
|
-
} catch (e) {
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (browser === "Douyin") {
|
|
525
|
-
try {
|
|
526
|
-
if (typeof tt !== "undefined" && typeof (tt == null ? void 0 : tt.getSystemInfo) === "function") {
|
|
527
|
-
browser = "Douyin Miniapp";
|
|
528
|
-
}
|
|
529
|
-
} catch (e) {
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
if (browser === "QQ") {
|
|
533
|
-
try {
|
|
534
|
-
if (typeof qq !== "undefined" && typeof (qq == null ? void 0 : qq.getSystemInfo) === "function") {
|
|
535
|
-
browser = "QQ Miniapp";
|
|
536
|
-
}
|
|
537
|
-
} catch (e) {
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
if (browser === "Kuaishou") {
|
|
541
|
-
try {
|
|
542
|
-
if (typeof ks !== "undefined" && typeof (ks == null ? void 0 : ks.getSystemInfo) === "function") {
|
|
543
|
-
browser = "Kuaishou Miniapp";
|
|
544
|
-
}
|
|
545
|
-
} catch (e) {
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
500
|
if (os === "iOS" && browser === "Safari") {
|
|
549
501
|
const m = /Version\/([\d.]+)/.exec(ua);
|
|
550
502
|
if (m && parseInt(m[1], 10) > parseInt(osVersion, 10)) {
|
|
@@ -743,60 +695,11 @@ function parseHeaders(headers) {
|
|
|
743
695
|
|
|
744
696
|
// src/index.ts
|
|
745
697
|
var { version: VERSION } = package_default;
|
|
746
|
-
var isWechatMiniapp = () => {
|
|
747
|
-
try {
|
|
748
|
-
return typeof __wxjs_environment !== "undefined" && __wxjs_environment === "miniprogram";
|
|
749
|
-
} catch (e) {
|
|
750
|
-
return false;
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
var isAlipayMiniapp = () => {
|
|
754
|
-
var _a;
|
|
755
|
-
try {
|
|
756
|
-
return typeof window !== "undefined" && typeof ((_a = window.my) == null ? void 0 : _a.getSystemInfo) === "function";
|
|
757
|
-
} catch (e) {
|
|
758
|
-
return false;
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
var isBaiduMiniapp = () => {
|
|
762
|
-
try {
|
|
763
|
-
return typeof swan !== "undefined" && typeof (swan == null ? void 0 : swan.getSystemInfo) === "function";
|
|
764
|
-
} catch (e) {
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
var isDouyinMiniapp = () => {
|
|
769
|
-
try {
|
|
770
|
-
return typeof tt !== "undefined" && typeof (tt == null ? void 0 : tt.getSystemInfo) === "function";
|
|
771
|
-
} catch (e) {
|
|
772
|
-
return false;
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
var isQQMiniapp = () => {
|
|
776
|
-
try {
|
|
777
|
-
return typeof qq !== "undefined" && typeof (qq == null ? void 0 : qq.getSystemInfo) === "function";
|
|
778
|
-
} catch (e) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
};
|
|
782
|
-
var isKuaishouMiniapp = () => {
|
|
783
|
-
try {
|
|
784
|
-
return typeof ks !== "undefined" && typeof (ks == null ? void 0 : ks.getSystemInfo) === "function";
|
|
785
|
-
} catch (e) {
|
|
786
|
-
return false;
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
698
|
function uaBrowser(ua) {
|
|
790
699
|
const nav = getNavContext();
|
|
791
700
|
return parseUA(ua != null ? ua : nav.userAgent, { nav });
|
|
792
701
|
}
|
|
793
702
|
uaBrowser.isWebview = isWebview;
|
|
794
|
-
uaBrowser.isWechatMiniapp = isWechatMiniapp;
|
|
795
|
-
uaBrowser.isAlipayMiniapp = isAlipayMiniapp;
|
|
796
|
-
uaBrowser.isBaiduMiniapp = isBaiduMiniapp;
|
|
797
|
-
uaBrowser.isDouyinMiniapp = isDouyinMiniapp;
|
|
798
|
-
uaBrowser.isQQMiniapp = isQQMiniapp;
|
|
799
|
-
uaBrowser.isKuaishouMiniapp = isKuaishouMiniapp;
|
|
800
703
|
uaBrowser.getLanguage = () => getLanguage(getNavContext());
|
|
801
704
|
uaBrowser.VERSION = VERSION;
|
|
802
705
|
var src_default = uaBrowser;
|
|
@@ -811,13 +714,7 @@ exports.getEnvContext = getEnvContext;
|
|
|
811
714
|
exports.getLanguage = getLanguage;
|
|
812
715
|
exports.getNavContext = getNavContext;
|
|
813
716
|
exports.getWindowsVersion = getWindowsVersion;
|
|
814
|
-
exports.isAlipayMiniapp = isAlipayMiniapp;
|
|
815
|
-
exports.isBaiduMiniapp = isBaiduMiniapp;
|
|
816
|
-
exports.isDouyinMiniapp = isDouyinMiniapp;
|
|
817
|
-
exports.isKuaishouMiniapp = isKuaishouMiniapp;
|
|
818
|
-
exports.isQQMiniapp = isQQMiniapp;
|
|
819
717
|
exports.isWebview = isWebview;
|
|
820
|
-
exports.isWechatMiniapp = isWechatMiniapp;
|
|
821
718
|
exports.parseHeaders = parseHeaders;
|
|
822
719
|
exports.parseUA = parseUA;
|
|
823
720
|
//# sourceMappingURL=index.cjs.map
|