Write programs using Java script for Web Page to display browsers information
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.
<!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>
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
aa
ReplyDelete