Javascript Reference - Navigator appVersion Property








Definition and Usage

The appVersion property returns the version information of the browser.

Browser Support

The appVersion property is supported in all major browsers.

appVersion Yes Yes Yes Yes Yes

Syntax

navigator.appVersion

Return Value

Type Description
String The version of the browser




The following code shows how to get the version of your browser.


<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!-- w  w w  .j a  v a 2 s  . com-->
<script>
function myFunction() {
    var x = "Version info: " + navigator.appVersion;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

A demonstration of all navigator properties.


<!DOCTYPE html>
<html>
<body>
<!-- w  w  w.j  ava2 s.co  m-->
<div id="demo"></div>

<script>
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>";
txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";

document.getElementById("demo").innerHTML = txt;
</script>

</body>
</html>

The code above is rendered as follows: