
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
@tool-developer/wo-useragent
Advanced tools
detect browser, os and device based on the userAgent string
浏览器环境正则处理输出,支持微信,QQ,国内等环境。
//
import UserAgent from '@tool-developer/wo-useragent';
const ua = new UserAgent(navigator.userAgent);
// console.log(ua)
{
mobile: true,
qq: true,
'qq-version': '6.7.1.416',
client: { name: 'qq', version: '6.7.1.416', major: 6, minor: 7, patch: 1 },
webkit: true,
engine: 'webkit',
ios: true,
'ios-version': 'iphone',
iphone: true,
iphone10: true,
'iphone-version': '10.2.1',
device: { name: 'iphone', version: '10.2.1', major: 10, minor: 2, patch: 1 }
}
目前支持engine、device、browser、client二级输出
{
name:"iphone",
major:10,
minor:2,
patch:1,
version:"10.2.1"
}
console.log(us.engine)
console.log(us.engine)
console.log(us.browser)
console.log(us.client)
// 微信
// ua.webchat
if(ua.micromessenger){
//
}
// Android
if(ua.android){
}
// iOS
if(ua.ios){
}
UserAgent.custom({
taobao: {
regex:/(?:tao|taobao)browser(?:.*version|)\/([\d.]+)/,
browser:true
}
})
| 属性 | 说明 |
|---|---|
| regex | 创建一个新的请求对象,形成请求链 |
| alias | 满足regex条件后,alias别名对应值也会标记为true |
| mobile | 标记为移动端,未标记的话默认会desktop为true |
| browser | 标记为浏览器处理 |
| device | 标记为设备处理 |
| client | 标记为客户端处理 |
| engine | 标记为浏览器引擎 |
| filter | 过滤掉某个属性的影响 |
| devtools | 识别开发者工具标记 |
| desktop | 识别桌面端标记 |
如果值输出true,正则中不能含有[子表达式捕获]处理,如果需要输出版本version,则需要对版本号进行[子表达式捕获]。
webkit: {
regex:/webkit\/(?:[\d.]+)/
},
只会输出webkit匹配结果
webkit: {
regex:/webkit\/([\d.]+)/
},
除了输出webkit匹配结果,还会输出webkit version,通过['webkit-version']输出。
FAQs
detect browser, os and device based on the userAgent string
The npm package @tool-developer/wo-useragent receives a total of 8 weekly downloads. As such, @tool-developer/wo-useragent popularity was classified as not popular.
We found that @tool-developer/wo-useragent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.