Window navigator.userAgent Property

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;

Try It Yourself

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>";

Try It Yourself

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