FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

Navigator language Property

Navigator Object Reference Navigator Object

Example

Get the language of your browser:

var x = "Language of the browser: " + navigator.language;

The result of x will be:

Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The language property returns the language version 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
language Yes 11.0 1.0 Yes Yes

Note: For IE10 and earlier, the closest available property is browserLanguage (see "More Examples").


Syntax

navigator.language

Technical Details

Return Value: A String, representing the language version of the browser.

Examples of valid language codes are: "en", "en-US", "de", "fr", etc.

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 »

Example

For IE10 and earlier versions, you can use the browserLanguage property:

var x = "Language of the browser: " + navigator.browserLanguage;
Try it Yourself »

Navigator Object Reference Navigator Object