User agent sniffingBaseline · Widely available
The navigator.userAgent property and several others loosely identify a browser. Selectively showing content based on the user agent string, also known as user agent sniffing, is unreliable. Consider using feature detection or user agent client hints instead.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 20, 2016. Widely available since Mar 20, 2019.
Browser support
DesktopChrome
1–3Not supported
4+Supportedsince Jan 25, 2010
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–3Not supported
3.5+Supportedsince Jun 30, 2009
Current: 157Safari
1–9.1Not supported
10+Supportedsince Sep 20, 2016
Current: 27MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157Safari iOS
1–9.3Not supported
10+Supportedsince Sep 13, 2016
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: appCodeName.
Feature detection
JS · check before using
if ("Navigator" in globalThis && "userAgent" in Navigator.prototype) {
// Navigator.userAgent is available
}Sub-features
Support for each part of the feature (17). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Navigator.appCodeName | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.appName | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.appVersion | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.javaEnabled | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.platform | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.plugins | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.product | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.productSub | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.userAgent | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.vendor | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Navigator.vendorSub | 1 | 12 | 1 | 3 | 18 | 4 | 1 |
| WorkerNavigator.appCodeName | 4 | 12 | 3.5 | 10 | 18 | 4 | 10 |
| WorkerNavigator.appName | 4 | 12 | 3.5 | 4 | 18 | 4 | 5 |
| WorkerNavigator.appVersion | 4 | 12 | 3.5 | 4 | 18 | 4 | 5 |
| WorkerNavigator.platform | 4 | 12 | 3.5 | 4 | 18 | 4 | 5 |
| WorkerNavigator.product | 4 | 12 | 3.5 | 10 | 18 | 4 | 10 |
| WorkerNavigator.userAgent | 4 | 12 | 3.5 | 4 | 18 | 4 | 5 |