Detect and parse Browser, Engine, OS, CPU, and Device type/model from a user-agent string. Useful for analytics and device-specific debugging.
A User-Agent string is sent by browsers with every HTTP request to identify the browser, operating system, and device type to the server.
For historical compatibility reasons modern browsers include multiple older browser identifiers.
Use navigator.userAgent. Avoid UA-based feature detection — use feature detection instead (e.g. if serviceWorker in navigator). Browsers are progressively freezing UA strings (User-Agent Reduction) to protect privacy, making UA parsing less reliable.
UA string limitations: modern browsers have complex, intentionally obfuscated UA strings (for historical compatibility); the new User-Agent Client Hints API is more structured and reliable; Chrome is progressively freezing UA strings. Still useful for: traffic analytics (distinguishing real users from bots); legacy system compatibility detection; anti-scraping; CDN and WAF bot detection. New projects should prefer the Client Hints API.