`

浏览器判断

 
阅读更多
<style>
	#browserTishi{
	    width:100%;
		background:#ddd;
		border:1px solid orange;
		font-size:18px;
		font-family: Arial,Tahoma,"宋体",sans-serif;
		color:red;
		text-align:center;
	}
	#browserTishi a{
		padding:0 0 0 10px;
		text-decoration:underline;
		color:blue;
		
	}
</style>
<script>
jQuery(document).ready(function() {
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
    (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
    (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
    (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
    (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
    
    var browserTishi = false;
    
    if(Sys.ie){
        var version = parseFloat(ua.substr(ua.indexOf("msie") + "msie".length));
    	if(version != 8){
    	    browserTishi = true;
    	}	
    }else if (!Sys.firefox){
        browserTishi = true;
    }
    if(browserTishi == false) {
        var browserTishiContent = '<div id="browserTishi" style="display:none;">';
    	browserTishiContent += '建议使用浏览器';
    	browserTishiContent += '<a href="http://view.atdmt.com/action/mrtiex_FY12IE9StaPrdIE8ProductpageforXPFNL_1?href=http://download.microsoft.com/download/1/6/1/16174D37-73C1-4F76-A305-902E9D32BAC9/IE8-WindowsXP-x86-CHS.exe">';
    	browserTishiContent += 'IE8';
    	browserTishiContent += '</a>';
    	browserTishiContent += '<a href="http://download.firefox.com.cn/releases/webins3.0/official/zh-CN/Firefox-latest.exe">';
    	browserTishiContent += 'Firefox';
    	browserTishiContent += '</a>';
    	browserTishiContent += '</div>';
    	
        $("body").prepend(browserTishiContent);
    	$("#browserTishi").slideDown("slow");
    }
});	
</script>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics