JavaScript to print browser name and version

// JavaScript to print browser name
// JavaScript to print browser version

Description

This script is used to print the browser name and version. The statement var browser=navigator.appName; fetches the browser name and stores it in the variable browser and bversion=navigator.appVersion; fetches the browser version and stores it in the variable bversion.

Code


<html>

<head>

<title>Name of Browser</title>

<script>

var browser=navigator.appName;

var bversion=navigator.appVersion;

var version=parseFloat(bversion);

document.write("<Font color=RED>Browser Name: </font>"+browser);

document.write("<br>");

document.write("<Font color=RED>Browser Version: </font>"+bversion);

</script>

<body></body>

</head>

</html>


Output

javascript to print browser name and version
Java Script - Browser name and version

No comments: