Monday 12 April 2021

Write programs using Java script for Web Page to display browsers information

 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>
Output:

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

1 comment:

The Future of Web Development: Why Next.js is Going Viral

  Are you ready to level up your web development game? Look no further than Next.js, the latest sensation in the world of web development th...