Pardon my French?
So I guess it's cute but most days I really don't give a about all this browser user agent detritus.
I just want to know which browser, which version, which operating system.
var ua = luserAgent(navigator.userAgent);
console.log("Hello "+ua.app+" "+ua.v+", on "+ua.os);
console.log(", world.");
You can drop the semi-colons or put them at the beginning of your lines or whatever if you're annoying like that, but honestly I'd rather you just use CoffeeScript at that point.
Eventually when I need it this will work as a CommonJS (node.js/CouchDB/browserify) module too. Right now I sometimes just copy/paste the code into my projects because that is awesome also*.
PLEASE: if you use this for browser detection you yes you Are The Reason we got this mess in the first place and I will cry. For you Argentina.
If all of the following are true:
- you are not using jQuery, and
- you have heard of Modernizr, and
- you have filed a bug for the browser bug you are fighting
Then you may use the provided information to gaurd a carefully considered workaround for said browser bug.
Else you may only use this library for human consumption (e.g. reable browser info for statitics or exception logs)
c.f. http://www.quirksmode.org/js/detect.html and http://www.javascripter.net/faq/browsern.htm probably many many others but I got sick of not being able to find them
https://developer.mozilla.org/en-US/docs/Browser_Detection_and_Cross_Browser_Support http://www.useragentstring.com/pages/links.php / http://www.useragentstring.com/pages/All/ http://tools.ietf.org/html/rfc2616#section-14.43
* so I really don't recommend just copy-pasting this into your project because my code here can only improve, but I also really don't care.
License: this but © me and I guess whoever else helped instead of that Sam dude. I don't even know that Sam dude.
But I love you.