Registry / testing / useragent-parser-js

useragent-parser-js

JSON →
library1.0.3jsnpmunverified

A JavaScript library for parsing user-agent strings into structured data including browser name, version, OS, platform, and device type flags. Current stable version is 1.0.3, released in 2015 with no recent updates. It supports CommonJS (Node.js), AMD (RequireJS), and direct browser usage via Bower. Key differentiators include a lightweight footprint and comprehensive boolean flags for mobile, tablet, desktop, and specific browsers/OSes. However, it is unmaintained and lacks TypeScript definitions, ESM support, and modern device/browser detection.

npm install useragent-parser-js
INSTALL
IMPORT
SIG · USERAGENT-PARSER-J
U
useragent-parser-js
testingjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
const parser = require('useragent-parser-js');
import parser from 'useragent-parser-js';
The library uses CommonJS; ESM import is not supported.
parse
const result = parser.parse(uaString);
parser.parse(uaString, callback);
parse() takes a single string argument synchronously, no callback.
default import
var parser = require('useragent-parser-js');
var parse = require('useragent-parser-js').parse;
The module exposes a single function directly, not as a named export.

Demonstrates basic usage: require the module, parse a user-agent string, and log the full result object with flags and properties.

const parser = require('useragent-parser-js'); const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'; const result = parser.parse(ua); console.log(result); // { // isMobile: false, // isDesktop: true, // isTablet: false, // isiPad: false, // isiPod: false, // isiPhone: false, // isAndroid: false, // isBlackberry: false, // isOpera: false, // isIE: false, // isIECompatibilityMode: false, // isSafari: false, // isFirefox: false, // isWebkit: true, // isChrome: true, // isKonqueror: false, // isOmniWeb: false, // isSeaMonkey: false, // isFlock: false, // isAmaya: false, // isEpiphany: false, // isWindows: true, // isLinux: false, // isLinux64: false, // isMac: false, // isChromeOS: false, // isBada: false, // isSamsung: false, // isRaspberry: false, // isBot: false, // isCurl: false, // isAndroidTablet: false, // isWinJs: false, // isKindleFire: false, // isSilk: false, // silkAccelerated: false, // browser: 'Chrome', // version: '91.0.4472.124', // os: 'Windows 10', // platform: 'Microsoft Windows', // source: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' // }
Debug
Known issues
breakingThe library is abandoned; may produce incorrect results for modern user-agent strings.
fix
Use actively maintained alternatives like ua-parser-js or useragent.
affects: >=0.0.0
deprecatedInstallation via Bower is deprecated. Bower is no longer maintained.
fix
Use npm or a CDN instead.
affects: >=0.0.0
gotchaThe module does not support ES modules (ESM). Using `import` will fail.
fix
Use `require()` for Node.js or include via script tag for browsers.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'useragent-parser-js'
The package name in npm is 'useragent-parser-js' but older documentation refers to 'useragent-parser'.
fix
Install using 'npm install useragent-parser-js' and require the correct name.
TypeError: parser.parse is not a function
Importing the library incorrectly as a named export or using ES6 import syntax.
fix
Use `const parser = require('useragent-parser-js');` and then `parser.parse(ua);`.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
useragent-parser-js — npm install useragent-parser-js · libregistry