javascript判断浏览器核心

/**
 * 判断浏览器核心
 * @return IE6.0/IE7.0/IE8.0/FireFox/Opera/other
 * @author ypz
 */
function browercheck(){
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,""); 
	if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0"){ 
		return "IE7.0"; 
	}else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){ 
		return "IE6.0"; 
	}else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0"){ 
		return "IE8.0"; 
	}else if(browser=="Netscape"){
		return "FireFox";
	}else if(browser=="Opera"){
		return "Opera";
	}else{
		return "other";
	}
}

你可能感兴趣的:(JavaScript,浏览器,Opera,Microsoft,firefox)