ua-browser 0.1.7 → 0.1.9

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 yangtianxia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 yangtianxia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,204 +1,206 @@
1
- # uaBrowser - 浏览器检测
2
-
3
- 通过userAgent和浏览器环境变量检测浏览器、系统及设备类型的常用工具
4
-
5
- ## npm安装
6
-
7
- ```javascript
8
- npm i ua-browser
9
- ```
10
-
11
- ## browser安装
12
-
13
- ```javascript
14
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ua-browser/dist/browser.min.js"></script>
15
- <script type="text/javascript">
16
- window.load = function() {
17
- var ua = uaBrowser()
18
- }
19
- </script>
20
- ```
21
-
22
- ## method
23
-
24
- ```typescript
25
- import { uaBrowser } from 'ua-browser'
26
-
27
- /** 浏览器解析 */
28
- uaBrowser(ua?: string): {
29
- version: string;
30
- osVersion: string;
31
- engine: string;
32
- browser: string;
33
- os: string;
34
- device: string;
35
- isWebview: boolean;
36
- language: string;
37
- platfrom: string;
38
- }
39
-
40
- /** 检查 `webview` 浏览环境,仅支持 `android` */
41
- uaBrowser.isWebview(ua: string): boolean
42
-
43
- /** 检查微信小程序 */
44
- uaBrowser.isWechatMiniapp(): boolean
45
-
46
- /** 浏览器语言 */
47
- uaBrowser.getLanguage(): string
48
-
49
- /** 当前版本 */
50
- uaBrowser.VERSION: string
51
- ```
52
-
53
- ## 浏览器
54
- ```typescript
55
- type browser =
56
- | 'Safari'
57
- | 'Chrome'
58
- | 'IE'
59
- | 'Edge'
60
- | 'Firefox'
61
- | 'Firefox Focus'
62
- | 'Chromium'
63
- | 'Opera'
64
- | 'Vivaldi'
65
- | 'Yandex'
66
- | 'Arora'
67
- | 'Lunascape'
68
- | 'QupZilla'
69
- | 'Coc Coc'
70
- | 'Kindle'
71
- | 'Iceweasel'
72
- | 'Konqueror'
73
- | 'Iceape'
74
- | 'SeaMonkey'
75
- | 'Epiphany'
76
- | '360'
77
- | '360EE'
78
- | '360SE'
79
- | 'UC'
80
- | 'QQBrowser'
81
- | 'QQ'
82
- | 'Baidu'
83
- | 'Maxthon'
84
- | 'Sogou'
85
- | 'Liebao'
86
- | '2345Explorer'
87
- | '115Browser'
88
- | 'TheWorld'
89
- | 'XiaoMi'
90
- | 'Quark'
91
- | 'Qiyu'
92
- | 'Wechat'
93
- | 'WechatWork'
94
- | 'Taobao'
95
- | 'Alipay'
96
- | 'Weibo'
97
- | 'Douban'
98
- | 'Suning'
99
- | 'iQiYi'
100
- | 'DingTalk'
101
- | 'Huawei'
102
- | 'Vivo'
103
- | 'Firefox Nightly'
104
- | 'Wechat Miniapp'
105
- ```
106
-
107
- ## 内核
108
-
109
- ```typescript
110
- type engine =
111
- | 'Trident'
112
- | 'Presto'
113
- | 'WebKit'
114
- | 'Gecko'
115
- | 'KHTML'
116
- | 'Blink'
117
- | 'EdgeHTML'
118
- ```
119
-
120
- ## 系统或平台
121
-
122
- ```typescript
123
- type os =
124
- | 'Windows'
125
- | 'Linux'
126
- | 'MacOS'
127
- | 'Android'
128
- | 'HarmonyOS'
129
- | 'Ubuntu'
130
- | 'FreeBSD'
131
- | 'Debian'
132
- | 'Windows Phone'
133
- | 'BlackBerry'
134
- | 'MeeGo'
135
- | 'Symbian'
136
- | 'iOS'
137
- | 'Chrome OS'
138
- | 'WebOS'
139
- ```
140
-
141
- ## 设备类型
142
-
143
- ```typescript
144
- type device =
145
- | 'Mobile'
146
- | 'Tablet'
147
- | 'Pc'
148
- ```
149
-
150
- ## 浏览器支持
151
-
152
- | 浏览器 | 标识 |
153
- | :-- | :-- |
154
- | 苹果系统默认浏览器 | `Safari` |
155
- | 谷歌浏览器 | `Chrome` |
156
- | 微软IE浏览器 | `IE` |
157
- | 微软新一代浏览器 | `Edge` |
158
- | 火狐浏览器 | `Firefox` |
159
- | 火狐浏览器 | `Firefox Focus` |
160
- | 谷歌浏览器开源版 | `Chromium` |
161
- | Opera浏览器 | `Opera` |
162
- | Opera联合创始人发布 | `Vivaldi` |
163
- | 俄罗斯最大搜索引擎Yandex出品 | `Yandex` |
164
- | 基于webkit和Qt的轻量级浏览器 | `Arora` |
165
- | 来自日本的三引擎浏览器 | `Lunascape` |
166
- | 轻量级跨平台浏览器 | `QupZilla` |
167
- | 越南搜索引擎浏览器 | `Coc Coc` |
168
- | 亚马逊电子书 | `Kindle` |
169
- | Firefox浏览器的Debian再发布版 | `Iceweasel` |
170
- | Konqueror | `Konqueror` |
171
- | Iceape | `Iceape` |
172
- | SeaMonkey | `SeaMonkey` |
173
- | Epiphany | `Epiphany` |
174
- | 360浏览器(手机版) | `360` |
175
- | 360安全浏览器 | `360EE` |
176
- | 360极速浏览器 | `360SE` |
177
- | UC浏览器 | `UC` |
178
- | QQ浏览器 | `QQBrowser` |
179
- | QQ客户端 | `QQ` |
180
- | 百度浏览器 | `Baidu` |
181
- | 傲游浏览器 | `Maxthon` |
182
- | 搜狗浏览器 | `Sogou` |
183
- | 猎豹浏览器 | `Liebao` |
184
- | 2345浏览器 | `2345Explorer` |
185
- | 115浏览器 | `115Browser` |
186
- | 世界之窗浏览器 | `TheWorld` |
187
- | 小米浏览器 | `XiaoMi` |
188
- | 夸克浏览器 | `Quark` |
189
- | 旗鱼浏览器 | `Qiyu` |
190
- | 微信手机客户端 | `Wechat` |
191
- | 企业微信客户端 | `WechatWork` |
192
- | 淘宝手机客户端 | `Taobao` |
193
- | 支付宝手机客户端 | `Alipay` |
194
- | 微博手机客户端 | `Weibo` |
195
- | 豆瓣手机客户端 | `Douban` |
196
- | 苏宁易购手机客户端 | `Suning` |
197
- | 爱奇艺手机客户端 | `iQiYi` |
198
- | 钉钉手机客户端 | `DingTalk` |
199
- | 华为浏览器 | `Huawei` |
200
- | Vivo浏览器 | `Vivo` |
201
- | Firefox 下一代网络浏览器Nightly | `Firefox Nightly` |
202
- | 微信小程序 | `Wechat Miniapp` |
203
-
204
-
1
+ # uaBrowser - 浏览器检测
2
+
3
+ 通过userAgent和浏览器环境变量检测浏览器、系统及设备类型的常用工具
4
+
5
+ ## 安装
6
+
7
+ ### npm
8
+
9
+ ```sh
10
+ npm i ua-browser
11
+ ```
12
+
13
+ ### pnpm
14
+
15
+ ```sh
16
+ pnpm add ua-browser
17
+ ```
18
+
19
+ ### yarn
20
+
21
+ ```sh
22
+ yarn add ua-browser
23
+ ```
24
+
25
+ ## 支持方法
26
+
27
+ ```typescript
28
+ import { uaBrowser } from 'ua-browser'
29
+
30
+ /** 浏览器解析 */
31
+ uaBrowser(ua?: string): {
32
+ version: string;
33
+ osVersion: string;
34
+ engine: string;
35
+ browser: string;
36
+ os: string;
37
+ device: string;
38
+ isWebview: boolean;
39
+ language: string;
40
+ platfrom: string;
41
+ }
42
+
43
+ /** 检查 `webview` 浏览环境,仅支持 `android` */
44
+ uaBrowser.isWebview(ua: string): boolean
45
+
46
+ /** 检查微信小程序 */
47
+ uaBrowser.isWechatMiniapp(): boolean
48
+
49
+ /** 浏览器语言 */
50
+ uaBrowser.getLanguage(): string
51
+
52
+ /** 当前版本 */
53
+ uaBrowser.VERSION: string
54
+ ```
55
+
56
+ ## 浏览器
57
+
58
+ ```typescript
59
+ type browser =
60
+ | 'Safari'
61
+ | 'Chrome'
62
+ | 'IE'
63
+ | 'Edge'
64
+ | 'Firefox'
65
+ | 'Firefox Focus'
66
+ | 'Chromium'
67
+ | 'Opera'
68
+ | 'Vivaldi'
69
+ | 'Yandex'
70
+ | 'Arora'
71
+ | 'Lunascape'
72
+ | 'QupZilla'
73
+ | 'Coc Coc'
74
+ | 'Kindle'
75
+ | 'Iceweasel'
76
+ | 'Konqueror'
77
+ | 'Iceape'
78
+ | 'SeaMonkey'
79
+ | 'Epiphany'
80
+ | '360'
81
+ | '360EE'
82
+ | '360SE'
83
+ | 'UC'
84
+ | 'QQBrowser'
85
+ | 'QQ'
86
+ | 'Baidu'
87
+ | 'Maxthon'
88
+ | 'Sogou'
89
+ | 'Liebao'
90
+ | '2345Explorer'
91
+ | '115Browser'
92
+ | 'TheWorld'
93
+ | 'XiaoMi'
94
+ | 'Quark'
95
+ | 'Qiyu'
96
+ | 'Wechat'
97
+ | 'WechatWork'
98
+ | 'Taobao'
99
+ | 'Alipay'
100
+ | 'Weibo'
101
+ | 'Douban'
102
+ | 'Suning'
103
+ | 'iQiYi'
104
+ | 'DingTalk'
105
+ | 'Huawei'
106
+ | 'Vivo'
107
+ | 'Firefox Nightly'
108
+ | 'Wechat Miniapp'
109
+ ```
110
+
111
+ ## 内核
112
+
113
+ ```typescript
114
+ type engine =
115
+ | 'Trident'
116
+ | 'Presto'
117
+ | 'WebKit'
118
+ | 'Gecko'
119
+ | 'KHTML'
120
+ | 'Blink'
121
+ | 'EdgeHTML'
122
+ ```
123
+
124
+ ## 系统或平台
125
+
126
+ ```typescript
127
+ type os =
128
+ | 'Windows'
129
+ | 'Linux'
130
+ | 'MacOS'
131
+ | 'Android'
132
+ | 'HarmonyOS'
133
+ | 'Ubuntu'
134
+ | 'FreeBSD'
135
+ | 'Debian'
136
+ | 'Windows Phone'
137
+ | 'BlackBerry'
138
+ | 'MeeGo'
139
+ | 'Symbian'
140
+ | 'iOS'
141
+ | 'Chrome OS'
142
+ | 'WebOS'
143
+ ```
144
+
145
+ ## 设备类型
146
+
147
+ ```typescript
148
+ type device =
149
+ | 'Mobile'
150
+ | 'Tablet'
151
+ | 'Pc'
152
+ ```
153
+
154
+ ## 浏览器支持
155
+
156
+ | 浏览器 | 标识 |
157
+ | :-- | :-- |
158
+ | 苹果系统默认浏览器 | `Safari` |
159
+ | 谷歌浏览器 | `Chrome` |
160
+ | 微软IE浏览器 | `IE` |
161
+ | 微软新一代浏览器 | `Edge` |
162
+ | 火狐浏览器 | `Firefox` |
163
+ | 火狐浏览器 | `Firefox Focus` |
164
+ | 谷歌浏览器开源版 | `Chromium` |
165
+ | Opera浏览器 | `Opera` |
166
+ | Opera联合创始人发布 | `Vivaldi` |
167
+ | 俄罗斯最大搜索引擎Yandex出品 | `Yandex` |
168
+ | 基于webkit和Qt的轻量级浏览器 | `Arora` |
169
+ | 来自日本的三引擎浏览器 | `Lunascape` |
170
+ | 轻量级跨平台浏览器 | `QupZilla` |
171
+ | 越南搜索引擎浏览器 | `Coc Coc` |
172
+ | 亚马逊电子书 | `Kindle` |
173
+ | Firefox浏览器的Debian再发布版 | `Iceweasel` |
174
+ | Konqueror | `Konqueror` |
175
+ | Iceape | `Iceape` |
176
+ | SeaMonkey | `SeaMonkey` |
177
+ | Epiphany | `Epiphany` |
178
+ | 360浏览器(手机版) | `360` |
179
+ | 360安全浏览器 | `360EE` |
180
+ | 360极速浏览器 | `360SE` |
181
+ | UC浏览器 | `UC` |
182
+ | QQ浏览器 | `QQBrowser` |
183
+ | QQ客户端 | `QQ` |
184
+ | 百度浏览器 | `Baidu` |
185
+ | 傲游浏览器 | `Maxthon` |
186
+ | 搜狗浏览器 | `Sogou` |
187
+ | 猎豹浏览器 | `Liebao` |
188
+ | 2345浏览器 | `2345Explorer` |
189
+ | 115浏览器 | `115Browser` |
190
+ | 世界之窗浏览器 | `TheWorld` |
191
+ | 小米浏览器 | `XiaoMi` |
192
+ | 夸克浏览器 | `Quark` |
193
+ | 旗鱼浏览器 | `Qiyu` |
194
+ | 微信手机客户端 | `Wechat` |
195
+ | 企业微信客户端 | `WechatWork` |
196
+ | 淘宝手机客户端 | `Taobao` |
197
+ | 支付宝手机客户端 | `Alipay` |
198
+ | 微博手机客户端 | `Weibo` |
199
+ | 豆瓣手机客户端 | `Douban` |
200
+ | 苏宁易购手机客户端 | `Suning` |
201
+ | 爱奇艺手机客户端 | `iQiYi` |
202
+ | 钉钉手机客户端 | `DingTalk` |
203
+ | 华为浏览器 | `Huawei` |
204
+ | Vivo浏览器 | `Vivo` |
205
+ | Firefox 下一代网络浏览器Nightly | `Firefox Nightly` |
206
+ | 微信小程序 | `Wechat Miniapp` |