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


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

Updated on: 30-Jul-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements