vigour-ua
ua parser with a light footprint (~1kb)
parse user agent strings
var ua = var userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.3'console
outputs
{
"browser": "chrome",
"version": 46,
"prefix": "webkit",
"platform": "mac",
"device": "desktop"
}
merge into objects
var ua = var someObject = randomField: trueconsole
outputs someObject
{
"browser": "chrome",
"version": 46,
"prefix": "webkit",
"platform": "mac",
"device": "desktop",
"randomField": true
}
This useragent parser does not catch all useragents, if you encounter a device thats wrongly parsed add a test!