Navigator language Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Navigator


The language property returns the language version of the browser.

This property is read-only.

Return Value

A String, representing the language version of the browser.

Examples of valid language codes are:

  • "en",
  • "en-US",
  • "de",
  • "fr",

The following code shows how to get the language of your browser:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {/*from   w w w  . ja  v  a  2  s. c  o  m*/
    var x = "Language of the browser: " + navigator.language;
    document.getElementById("demo").innerHTML = x;


Related Tutorials