X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Navigator userAgent Property

Navigator Object Reference Navigator Object

Example

The user-agent header sent by your browser is:

var x = "User-agent header sent: " + navigator.userAgent;

The result of x will be:


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


Examples

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 Reference Navigator Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook