Home >>Javascript Programs >How to Get browser details through JavaScript
In this article, we will learn how to create a program to get browser details through JavaScript.
To contain the information about the visitor’s browser, we can use window.navigator object. There are number of browsers available that has different features. Different browsers information is accessible to the websites through JavaScript.
The window.navigator object contains information about the visitor's browser.
Let's take an example:
<!DOCTYPE HTML> <html> <head> <title> Get browser details through JavaScript </title> </head> <body> <!-- The text field --> <div id="example"></div> <script> txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>"; txt+= "<p>Browser Name: " + navigator.appName + "</p>"; txt+= "<p>Browser Version: " + navigator.appVersion + "</p>"; document.getElementById("example").innerHTML=txt; </script> </body> </html>