About user-agent parser
The User-Agent header is a string a browser sends to say what it is. The parser breaks it into browser, operating system and device.
Why they look odd
Almost every browser starts with Mozilla/5.0 for historical compatibility, so the useful details are further along the string.
Use with care
User-Agent strings can be changed, and browsers are reducing the detail they share. Use feature detection for compatibility instead of browser sniffing.
A worked example
The string Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 is Chrome 124 on 64-bit Windows 10 or 11. The words Gecko and Safari are there for historical compatibility and do not mean Firefox or Safari.
Modern alternatives
- User-Agent Client Hints give structured browser information.
- Feature detection checks what the browser can do, instead of guessing from its name.
- Logs still use the user agent to spot bots and popular browsers.
