Window navigator.userAgent Property
- Previous Page taintEnabled()
- Next Page appCodeName
- Go Up One Level Window Navigator
Definition and Usage
userAgent
This property returns the user-agent header that the browser sends to the server.
userAgent
The property is read-only.
The returned value contains information about the browser name, version, and platform.
The Web specification recommends that browsers provide as little header information as possible. Never assume that this property will remain unchanged in future browsers.
Instance
Example 1
Get navigator.userAgent:
let agent = navigator.userAgent;
Example 2
Display all navigator properties:
let text = "<p>Browser CodeName: " + navigator.appCodeName + "</p>" + "<p>Browser Name: " + navigator.appName + "</p>" + "<p>Browser Version: " + navigator.appVersion + "</p>" + "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>" + "<p>Browser Language: " + navigator.language + "</p>" + "<p>Browser Online: " + navigator.onLine + "</p>" + "<p>Platform: " + navigator.platform + "</p>" + "<p>User-agent header: " + navigator.userAgent + "</p>";
Syntax
navigator.userAgent
Return Value
Type | Description |
---|---|
String | Browser User-Agent Header. |
Browser Support
All Browsers Support navigator.userAgent
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous Page taintEnabled()
- Next Page appCodeName
- Go Up One Level Window Navigator