ua-parser-js README

The project's README from github.com/faisalman/ua-parser-js. As one markdown file: README.md.

UAParser.js

UAParser.js UAParser.js UAParser.js

UAParser.js

Powerful User-Agent detection in a compact, ES5-friendly, dependency-free JavaScript library.

Demo

Documentation

Before upgrading from v0.7 / v1.0, please read CHANGELOG to see what's new & breaking.

Package Options

Open-Source Editions PRO / Commercial Editions
License options MIT (v1.x) AGPL (v2.x) PRO Personal PRO Business PRO Enterprise
Browser Detection ⚠️ ✅ ✅ ✅ ✅
CPU Detection ⚠️ ✅ ✅ ✅ ✅
Device Detection ⚠️ ✅ ✅ ✅ ✅
Rendering Engine Detection ⚠️ ✅ ✅ ✅ ✅
OS detection ⚠️ ✅ ✅ ✅ ✅
Enhanced+ Accuracy ❌ ✅ ✅ ✅ ✅
Bot Detection ❌ ✅ ✅ ✅ ✅
AI Detection ❌ ✅ ✅ ✅ ✅
Extra Detections (Apps, Libs, Emails, Media Players, Crawlers, and more) ❌ ✅ ✅ ✅ ✅
Client Hints Support ❌ ✅ ✅ ✅ ✅
CommonJS Support ✅ ✅ ✅ ✅ ✅
ESM Support ❌ ✅ ✅ ✅ ✅
TypeScript Definitions ✅ ✅ ✅ ✅ ✅
npm Module Available ✅ ✅ ✅ ✅ ✅
Direct Downloads Available ✅ ✅ ✅ ✅ ✅
Commercial Use Allowed ✅ ✅ ❌ ✅ ✅
Permissive (non-Copyleft) License ✅ ❌ ✅ ✅ ✅
No Open-Source Obligations ✅ ❌ ✅ ✅ ✅
Unlimited End-Products ✅ ✅ ✅ ❌ ✅
Unlimited Deployments ✅ ✅ ✅ ❌ ✅
1-year Product Support ❌ ❌ ✅ ✅ ✅
Lifetime Updates ✅ ✅ ✅ ✅ ✅
Price FREE* (License) FREE* (License) $14 (License) $29 (License) $599 (License)

GET THE PRO PACKAGES 📥

NEW: Managed REST API

Skip the installation, use the User-Agent API in any application:

Learn more and start building at uaparser.dev/#rest-api

Development

Contributors

This project wouldn't be possible without all the amazing people in the open-source community. Thanks to everyone who contributed, reported issues, and shared feedback.

Made with contributors-img.

Contributions are welcome! Please read the CONTRIBUTING GUIDE first for detailed contribution instructions.

Backers & Sponsors

Support the open-source editions of UAParser.js through one of the following options:

OpenCollective GitHub Sponsors PayPal WeChat/Alipay

ua-parser-js (faisalman/ua-parser-js)

Searching Database…

这是干什么的?UAParser.js 是一个轻巧、无依赖的 JavaScript 库,用来解析 user-agent 字符串,识别浏览器、操作系统、设备、CPU、渲染引擎、机器人程序和 AI 爬虫。
它是嵌进我自己代码里的库,还是我调用在线服务?是嵌在你自己 JavaScript 代码里的库,通过 npm 安装或直接下载,可以在浏览器或服务器上运行。如果不想安装,也有一个托管 REST API,底层用的是同一个解析器。
怎么把它加进我的项目?安装 npm 包或直接下载文件,然后在浏览器、Node.js 或其他现代 JS 运行环境里使用。自带 TypeScript 类型定义,开箱即用,不需要额外配置。
除了 JavaScript,运行它还需要别的东西吗?不需要。它是兼容 ES5 的代码,没有构建要求,可以在浏览器、Node.js 以及其他现代 JavaScript 运行环境里运行,任意 Node 版本都行。
免费版相比 PRO 版少了什么?免费版在核心识别结果(浏览器、CPU、设备、引擎、操作系统)上会带一个警告标记,并且不包含机器人和 AI 爬虫识别、客户端提示(client hints)支持以及增强精度——这些只在付费的 PRO 版本里提供。
免费版能用在商业项目里吗?可以:v1.x 采用 MIT 协议,v2.x 采用 AGPL-3.0,两个开源版本都允许商业使用。AGPL 是 copyleft(传染性)协议,所以团队如果想用宽松协议、不承担开源义务,可以购买付费的 PRO 版本($14-$599)。
它到底能识别出什么?免费版可以识别浏览器、CPU、设备、渲染引擎和操作系统。付费的 PRO 版本还增加机器人和 AI 爬虫识别、应用、邮件客户端、媒体播放器等更多识别对象,并支持客户端提示(client hints)和增强精度。
我用的是 v0.7 或 v1.x,升级到 v2 会很麻烦吗?不会自动平滑升级:README 要求先阅读 CHANGELOG,因为 v2 包含破坏性变更(breaking changes),而且免费版的协议也从 MIT 变成了 AGPL。
它支持 ES 模块和 TypeScript 吗?所有版本都自带 TypeScript 类型定义。根据对比表,ESM 支持是从 v2.x AGPL 版和 PRO 版开始才有的,v1.x 系列只支持 CommonJS。
识别数据的更新有多及时?它背后有一个持续维护、覆盖面很广的识别数据库,号称经过大规模实战检验,并被多家知名科技公司采用。
What are similar projects?core-js, lodash, turndown, validator.js, lollipop-css, ky, marked, cheerio
Creator
faisalman
Size
20.9 MB
Stars
10.2K
Age
14y
Commits · 90 Days