Navigator userAgent Property
Example
The user-agent header sent by your browser is:
var x = "User-agent header sent: " + navigator.userAgent;
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The userAgent property returns the value of the user-agent header sent by the browser to the server.
The value returned, contains information about the name, version and platform of the browser.
Note: This property is read-only.
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
userAgent | Yes | Yes | Yes | Yes | Yes |
Syntax
navigator.userAgent
Technical Details
Return Value: | A String, representing the user agent string for the current browser |
---|
More Examples
Example
A demonstration of all navigator properties in one example:
var txt = "";
txt += "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt += "<p>Browser Name: " + navigator.appName + "</p>";
txt += "<p>Browser Version: " + navigator.appVersion + "</p>";
txt += "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt += "<p>Browser Language: " + navigator.language + "</p>";
txt += "<p>Browser Online: " + navigator.onLine + "</p>";
txt += "<p>Platform: " + navigator.platform + "</p>";
txt += "<p>User-agent header: " + navigator.userAgent + "</p>";
Try it Yourself »
❮ Navigator Object