https://github.com/fkei/sua.js
Simple user agent parser library. - NodeJS/Browser supported
https://github.com/fkei/sua.js
android browser ios nodejs sua useragent useragent-parser
Last synced: 2 months ago
JSON representation
Simple user agent parser library. - NodeJS/Browser supported
- Host: GitHub
- URL: https://github.com/fkei/sua.js
- Owner: fkei
- License: mit
- Created: 2015-06-05T09:44:13.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2021-08-02T20:13:47.000Z (over 4 years ago)
- Last Synced: 2026-01-24T09:47:54.481Z (3 months ago)
- Topics: android, browser, ios, nodejs, sua, useragent, useragent-parser
- Language: JavaScript
- Homepage:
- Size: 80.1 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ☕️ sua.js
[](LICENSE)
[](https://travis-ci.org/fkei/sua.js)
[](https://badge.fury.io/js/sua.js)
A simple User-Agent string parser.
(Node.js or Browser supported)
## 🔰 Install
```bash
$ npm install sua.js
or
$ bower install sua.js
```
## 🎬 Quick Start
Browser
```html
var sua = new SUA('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1');
if (!!sua.ios11) {
// OK!!
}
```
NodeJS
```js
var SUA = require('sua.js');
var sua = new SUA('Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1');
if (!!sua.ios11) {
// OK!!
}
```
## ✨ Feature
Supported Browsers
- [x] ua.Android 2.1
- [x] ua.Android 2.2
- [x] ua.Android 2.3
- [x] ua.Android 3.x
- [x] ua.Android 4.x
- [x] ua.Android 5.0
- [x] ua.Android 5.1
- [x] ua.Android 6.x
- [x] ua.Android 7.0
- [x] ua.Android 7.1
- [x] ua.Android 8.0
- [x] ua.iphone (IOS4)
- [x] ua.iphone (IOS5)
- [x] ua.iphone (IOS6)
- [x] ua.iphone (IOS7)
- [x] ua.iphone (IOS8)
- [x] ua.iphone (IOS9)
- [x] ua.iphone (IOS10)
- [x] ua.iphone (IOS11)
- [x] ua.iphone (IOS12)
- [x] ua.iphone (IOS4-ipad)
- [x] ua.iphone (IOS5-ipad)
- [x] ua.iphone (IOS6-ipad)
- [x] ua.iphone (IOS7-ipad)
- [x] ua.iphone (IOS8-ipad)
- [x] ua.iphone (IOS9-ipad)
- [x] ua.iphone (IOS10-ipad)
- [x] ua.iphone (IOS11-ipad)
- [ ] ua.iphone (IOS12-ipad)
- [x] ua.iphone5 (hardware)
- [x] ua.blackberry
- [x] ua.webos
- [x] ua.touchpad
- [x] ua.kindle
- [x] ua.silk
- [x] ua.bb10
- [x] ua.rimtabletos
- [x] ua.playbook
- [x] ua.ds
- [x] ua.psp
- [x] ua.psvita
- [x] ua.windowsphone
- [x] ua.safari
- [x] ua.xbox
- [x] ua.ie11 Edge
- [x] ua.ie11
- [x] ua.ie10
- [x] ua.ie9
- [x] ua.android.firefox
- [x] ua.webview.twitter
- [x] ua.chrome pc
- [x] ua.firefox pc
- [x] ua.safari pc
- [x] ua.vivaldi
- [x] ua.wiiu (Wii U)
- [x] ua.nintendo_switch (Nintendo Switch)
- [x] ua.chromecast
- [x] ua.roku.ultra
- [x] ua.amazon.4k
- [x] ua.fire.tv
- [x] ua.google.nexus.player
- [x] ua.apple.tv
- [x] ua.playstation.3
- [x] ua.playstation.4
## 🗳 File size
```
sua.js (size: 14K)
sua.min.js (size: 5.2K) minified with uglify2
```
## 🏗 Build
```sh
$ npm run build # output: sua.min.js
```
## 🐛 Test
```
Browser : $ ./spec/index.html
Terminal : $ npm test
```
## 📄 License
@see : [LICENSE](https://github.com/fkei/sua.js/blob/master/LICENSE)