浏览器的判断

//浏览器的判断
brower = function() {
	 var ua = navigator.userAgent.toLowerCase();
	 var os = new Object();
	 os.isFirefox = ua.indexOf ('firefox') != -1;
	 os.isOpera = ua.indexOf ('opera') != -1;
	 os.isChrome = ua.indexOf ('chrome') != -1;
	 os.isIE = !os.isOpera  &&  ua.indexOf ('msie') != -1;
	 os.isIE7 = os.isIE  &&  ua.indexOf ('7.0') != -1;
	 os.isIE8 = os.isIE  &&  ua.indexOf ('trident/4.0') != -1;
	 return os;
}

	if(brower().isIE7)
	{
		
	}
	else if(brower().isIE)
	{
		
	}
	else if(brower().isFirefox)
	{
		
	}
	else if(brower().isChrome)
	{
		
	}
	else if(brower().isIE8)
	{
		
	}
}

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