You are here: Reference > JavaScript > client-side > browser > properties > language (clientInformation, navigator)

language property (clientInformation, navigator)

Browser support:
Returns the language of the browser application.
There are other properties that contain information about the user's language settings:
  • The language property returns the language of the browser application in Opera and older versions of Internet Explorer, or the language of the operating system's user interface from Internet Explorer 5.
  • The systemLanguage property returns the language edition of the operating system in Internet Explorer
  • The userLanguage property returns the current Regional and Language settings of the operating system in Internet Explorer and the language of the browser application in Opera.
If you need to detect the type of the user's browser, please see the page for Browser detection. To get various information about the browser and the operating system of the user, please see the page for the navigator object and the example below.

Syntax:

object.language;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the language.
Default: this property has no default value.

Example HTML code 1:

This example displays various language settings:
<head>
    <script type="text/javascript">
        function GetLangInfo () {
            var message = "";
            message += "Language of the browser: " + window.navigator.language;

            message += "<br />Operating system: " + window.navigator.platform;
            if (window.navigator.language === undefined) {  
                // in Opera, the language, browserLanguage and userLanguage properties are equivalent
                message += "<br />Language of the operating system's user interface: " + window.navigator.browserLanguage;
                message += "<br />Regional and Language settings of the operating system: " + window.navigator.userLanguage;
            }
            message += "<br />Language of the installed operating system: " + window.navigator.systemLanguage;

            var output = document.getElementById ("output");
            output.innerHTML = message;
        }
    </script>
</head>
<body onload="GetLangInfo ();">
    <div id="output"></div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content