UserAgent detection class for JavaScript