Home > Javascript > Detect browser name and version

Detect browser name and version

If your writing cross-browser web applications, it is nessary to detcect Browser name and version. Because some of the javascript code like forms[] and controls[] will not work in all browsers, and document.getElementById() will not work in old version browsers.

Here is the code to detect browser name and version.

var browser=navigator.appName
var version= parseFloat(navigator.appVersion)
alert("You are running " + browser +" and your browser version is " + version);

This will popup an alert box with browser name and version.

Categories: Javascript Tags: ,
  1. No comments yet.
  1. No trackbacks yet.