Open In App

HTML DOM Navigator language Property

The Navigator language property is used for returning the browser’s language version. It is a read-only property and it returns a string representing the language version of the browser. 

Some of the possible language codes are :  



Syntax: 

navigator.language

Below program illustrates the Navigator language Property :



Checking the browser’s language version.  




<!DOCTYPE html>
<html>
<head>
    <title>
      Navigator language Property in HTML
    </title>
    <style>
        h1 {
            color: green;
        }
          
        h2 {
            font-family: Impact;
        }
          
        body {
            text-align: center;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
    <h2>Navigator language Property</h2>
      
<p>For checking the browser's language,
       double click the "Check Language" button:
    </p>
  
    <button ondblclick="checklang()">
      Check Language
    </button>
  
    <p id="lang"></p>
  
    <script>
        function checklang() {
            var l = 
                "Browser's Language : " + navigator.language;
            document.getElementById("lang").innerHTML = l;
        }
    </script>
</body>
</html>

Output: 
Before clicking the button:

After clicking the button:

Supported Browsers: The browser supported by HTML|Navigator language property are listed below: 


Article Tags :