How to get the application name and version information of a browser in JavaScript?

JavascriptObject Oriented ProgrammingFront End Technology

Javascript has provided a navigator object with which we can find any information regarding the browser. To get the application name and version information, navigator object has provided navigator.appName() and navigator.appVersion() respectively. Let's discuss each of them individually.

Application Name of the browser

To get the application name, the navigator object has provided navigator.appName(). It may sound weird that "Netscape" is the application name for IE11, Chrome, Firefox, and Safari. So the output we get when we use navigator.appName() is Netscape.

Example

Live Demo

<html>
<body>
<script>
   document.write(navigator.appName);
</script>
</body>
</html>

Output

Netscape


Browser version information

To get the browser version information, the navigator object has provided navigator.appVersion(). This gives information regarding the browser.

Example

Live Demo

<html>
<body>
<script>
   document.write(navigator.appVersion);
</script>
</body>
</html>

Output

5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
raja
Published on 17-Jul-2019 17:12:35
Advertisements