This User-Agent parser uses sequential pattern matching with regular expressions to identify components within the UA string. It first checks for mobile and tablet indicators to determine device type, then matches known browser signatures (Chrome, Firefox, Safari, Edge, Opera) against version tokens. Operating system detection scans for platform identifiers like "Windows NT," "Mac OS X," "Android," or "iPhone OS" and extracts version numbers from adjacent tokens. The rendering engine is identified by searching for AppleWebKit, Gecko, or Trident signatures. All patterns are evaluated in priority order to handle ambiguous strings correctly.
What is a User-Agent string?
A User-Agent string is a text identifier sent by your browser with every HTTP request. It contains information about your browser name and version, operating system, and device type, allowing websites to optimize content delivery for your specific setup.
How does a User-Agent parser work?
A User-Agent parser analyzes the raw UA string using pattern matching and regular expressions to identify known tokens for browsers (Chrome, Firefox, Safari, Edge), operating systems (Windows, macOS, Android, iOS), and device indicators (Mobile, Tablet keywords) to extract structured information.
Can websites see my full User-Agent string?
Yes, every website you visit receives your User-Agent string as part of the HTTP request headers. This is how servers determine compatibility, serve appropriate content, and track browser usage statistics. Modern browsers are gradually reducing UA string detail for privacy through User-Agent Client Hints.