A JS port of Browserscope's user agent parser.
Pull request Compare This branch is 919 commits behind tobie:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts
.gitignore
LICENSE
README.markdown
index.js
package.json
regexes.json

README.markdown

ua-parser

ua-parser is a port to node.js of BrowserScope's user agent string parser.

The crux of the original parser--the data collected by Steve Souders over the years--has been extracted into a separate JSON file so as to be reusable as is by implementations in other programming languages.

ua-parser is just a small wrapper around this data.

Usage

var uaParser = require('ua-parser');
var ua = uaParser.parse(navigator.userAgent);

console.log(ua.tostring());
// -> "Safari 5.0.1"

console.log(ua.toVersionString());
// -> "5.0.1"

console.log(ua.toFullString());
// -> "Safari 5.0.1/Mac OS X"

console.log(ua.family);
// -> "Safari"

console.log(ua.major);
// -> 5

console.log(ua.minor);
// -> 0

console.log(ua.patch);
// -> 1

console.log(ua.os);
// -> Mac OS X

License

Your choice of MIT or Apache, Version 2.0 licenses for the JS code which is Copyright 2010 Tobie Langel.

The data contained in regexes.json is Copyright 2009 Google Inc. and available under the Apache License, Version 2.0.