Sunday, November 21, 2010

Function to check browser name in javascript

function check_browser()
{
try
{
var browserName=navigator.appName;
var browserVer=parseInt(navigator.appVersion);
if ((navigator.userAgent.indexOf('MSIE') != -1) && browserVer>=4)
{
browser_name='IE';
}
else if((navigator.userAgent.indexOf('Chrome') != -1) && browserVer>=4)
{
browser_name='Chrome';
}
else
{
browser_name='FireFox';
}
}
}

0 comments:

Post a Comment