Try using some of this code and see how you do:
function browserVer()
{
// :Variables:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
flag = 0; //Flag used to determine if browser was found.
string = ""; //Browser will hold the name of the current browser.
test = navigator.userAgent.split(" "

; //Test is used to hold userAgent after being "split" into an array.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//alert(navigator.userAgent);
for(x = 0; x < test.length; x++)
{
switch (test[x])
{
case "Opera/5.12"://Catch Opera 5.12 identified as Opera
string = "1: Opera 5.12";
browser = "1";
flag = 1;
break;
case "Opera/6.0"://Catch Opera 6.0 identified as Opera
string = "2: Opera 6.0";
browser = "2";
flag = 1;
break;
case "Opera"://Catch Opera not identified as Opera
string = "3: Opera " + test[x+1];
browser = "3";
flag = 1;
break;
case "MSIE"://Catch IE (tested on 6.0 successfully)
string = "4: IE ver " + test[x+1];
browser = "4";
break;
case "Netscape6/6.2"://Catch Netscape 6.2
string = "5: Netscape 6.2";
browser = "5";
flag = 1;
break;
case "Netscape6/6.2.1"://Catch Netscape 6.2.1
string = "6: Netscape 6.2.1";
browser = "6";
flag = 1;
break;
default:
//Catch Netscape (tested on 4.7 successfully)
if (flag != 1)
{
if (navigator.appName == "Netscape"

{
string = "Default: Netscape " + parseFloat(navigator.appVersion);
browser = "default";
}
}
break;
}
if (flag == "1"

{
break; //Exit loop
}
}
//alert(browser);
alert(string);
}