Change calculation of `userAgent`.

Default to 'node-js' only if no user agent can be found the normal way.
pull/344/head
Chad Weider 2012-01-15 19:03:03 -08:00
parent 548c527aaf
commit 50d304022d
1 changed files with 2 additions and 8 deletions

View File

@ -80,14 +80,8 @@ function isArray(testObject)
return testObject && typeof testObject === 'object' && !(testObject.propertyIsEnumerable('length')) && typeof testObject.length === 'number';
}
if (typeof exports !== "undefined")
{
userAgent = "node-js";
}
else
{
userAgent = navigator.userAgent.toLowerCase();
}
var userAgent = (((function () {return this;})().navigator || {}).userAgent || 'node-js').toLowerCase();
// Figure out what browser is being used (stolen from jquery 1.2.1)
var browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],