js获取用户浏览器信息

2个月前 (03-11 20:43)阅读44回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4189
  • 级别管理员
  • 主题837
  • 回复2
楼主

通过js脚本来检测当前用户的浏览器信息,将获取到的信息反馈回来,实现其他功能,实用js获取浏览器信息脚本。

<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>检测访客浏览器信息js脚本_武鸣人</title>
<script type="text/javascript">
<!--
function TClientCheck() {
    this.userAgent=navigator.userAgent;
    this.getBrowse=TClientCheck_Browse;
    this.getOS=TClientCheck_OS;
    this.browseKernel="unknown";
    this.isDOMSupport=false;//是否支持DOM
    if(document.getElementById) {
        this.isDOMSupport=true;
    }
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
function TClientCheck_Browse() {
    var sUA=this.userAgent;
     //检测IE浏览器
    if ((navigator.appName == "Microsoft Internet Explorer")) {
        //检测模拟IE浏览的OPERA。edit at 2006-11-08(ver 0.1.2)
        if (sUA.indexOf('Opera')!=-1) {
            this.browseKernel='Presto';
            if(window.opera && document.childNodes ) {
                return 'Opera 7+';
            } else {
                return 'Opera 6-';
            }
        }
        this.browseKernel='Trident';
        if(sUA.indexOf('Maxthon')!=-1) {
            return 'Maxthon';
        }
        if(sUA.indexOf('TencentTraveler')!=-1) { //ver 0.1.3
            return '腾迅TT';
        }
        if(document.getElementById) {
            return "IE5+";
        } else {
             return "IE4-";
        }
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
    //检测Gecko浏览器
    if(sUA.indexOf('Gecko')!=-1) {
        this.browseKernel='Gecko';
        if(navigator.vendor=="Mozilla") {return "Mozilla";}
        if(navigator.vendor=="Firebird") {return "Firebird"; }
        if (sUA.indexOf('Firefox')!=-1) {return 'Firefox';  }
        return "Gecko";
    }
    //Netscape浏览器
    if(sUA.indexOf('Netscape')!=-1) {
        this.browseKernel='Gecko';
        if(document.getElementById) {
            return "Netscape 6+";
        } else {
            return 'Netscape 5-';
        }
    }
    //检测Safari浏览器
    if(sUA.indexOf('Safari') != -1) {this.browseKernel='KHTML';return 'Safari';}
    if(sUA.indexOf('konqueror')!=-1) {this.browseKernel='KHTML';return 'Konqueror';}
    //目前世界公认浏览网页速度最快的浏览器,但它占用的系统资源也很大。
    if(sUA.indexOf('Opera') != -1) {
        this.browseKernel='Presto';
        if(window.opera && document.childNodes ) {
            return 'Opera 7+';
        } else {
            return 'Opera 6-';
        }
        return 'Opera';
    }
    if((sUA.indexOf( 'hotjava' )!=-1) && typeof( navigator.accentColorName ) == 'undefined' ) {return 'HotJava';}
    if( document.all && document.getElementById && navigator.savePreferences && (sUA.indexOf( 'netfront' ) < 0 ) && navigator.appName != 'Blazer' ) {return 'Escape 5'; }
    //Konqueror / Safari / OmniWeb 4.5+
    if( navigator.vendor == 'KDE' || ( document.childNodes && ( !document.all || navigator.accentColorName ) && !navigator.taintEnabled ) ) {this.browseKernel='KHTML';return 'KDE';}
    if( navigator.__ice_version ) { return 'ICEbrowser';}
    if( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) {
        if( document.createElement ) {
            return 'iCab 3+';
        } else {
            return 'iCab 2-';
        }
    }
    if(document.layers && !document.classes ) {return 'Omniweb 4.2-';}
    if(document.layers && !navigator.mimeTypes['*'] ) {return 'Escape 4';}
    if(navigator.appName.indexOf( 'WebTV' ) + 1 ) {return 'WebTV';}
    if(sUA.indexOf( 'netgem' )!=-1 ) {return 'Netgem NetBox';}
    if(sUA.indexOf( 'opentv' )!=-1 ) {return 'OpenTV';}
    if(sUA.indexOf( 'ipanel' )!=-1) {return 'iPanel MicroBrowser';}
    if(document.getElementById && !document.childNodes) {return 'Clue browser';}
    if(document.getElementById && ( (sUA.indexOf( 'netfront' ) !=-1) || navigator.appName == 'Blazer' ) ) {return 'NetFront 3+';}
    if((sUA.indexOf( 'msie' ) + 1 ) && window.ActiveXObject ) {return 'Pocket Internet Explorer'; }
    return "Unknown";
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
/**
* 操作系统信息检测
*
* @类型:公共方法
* @参数:无
* @返回:操作系统名称
* @备注:
*/
function TClientCheck_OS() {
    var sUA=this.userAgent.toLowerCase();
    if(sUA.indexOf( 'win' ) !=-1){
         if(sUA.indexOf("nt 5.2")!=-1) {return "Windows 2003";}
         if((sUA.indexOf("nt 5.1")!=-1)||(sUA.indexOf("XP")!=-1)) {return "Windows XP"; }
         if((sUA.indexOf('nt 5.0')!=-1) || (sUA.indexOf('2000')!=-1)) {return 'Windows 2000';}
         if((sUA.indexOf("winnt")!=-1) || (sUA.indexOf("windows nt")!=-1)) {return "Windows NT";}
         if((sUA.indexOf("win98")!=-1) || (sUA.indexOf("windows 98")!=-1)) {return "Windows 98";}
         return "Windows";
    }
    if(sUA.indexOf('linux')!=-1) {return 'Linux';}
    if(sUA.indexOf("freebsd")!=-1) {return 'FreeBSD';}
    if(sUA.indexOf( 'x11' )!=-1) {return 'Unix';}
    if(sUA.indexOf('mac') != -1) {return "Mac"; }
    if(sUA.indexOf("sunos")!=-1) {return 'Sun OS';}
    if((sUA.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (sUA.indexOf("ibm-webexplorer")!=-1)) {return "OS 2"}
    if(navigator.platform == 'PalmOS' ) {return 'Palm OS'; }
    if((navigator.platform == 'WinCE' ) || ( navigator.platform == 'Windows CE' ) || ( navigator.platform == 'Pocket PC' ) ) {return 'Windows CE';}
    if(sUA.indexOf( 'webtv')!=-1) {return 'WebTV Platform'; }
    if(sUA.indexOf( 'netgem')!=-1) {return 'Netgem';}
    if(sUA.indexOf( 'opentv')!=-1) {return 'OpenTV Platform';}
    if(sUA.indexOf( 'symbian')!=-1) {return 'Symbian';}
    return "Unknown";
}
//-->
</script>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div id="www_wuming_ren"></div>
<script type="text/javascript">
<!--
    var oCC=new TClientCheck();
    var oInfo=document.getElementById('www_wuming_ren');
    oInfo.innerHTML='<p>您使用的是浏览器是:<strong>'+oCC.getBrowse()+'</strong></p><p>您使用的浏览器的内核是:<strong>'+oCC.browseKernel+'</strong></p><p>您使用的操作系统是:<strong>'+oCC.getOS()+'</strong></p><p>User Agent:'+oCC.userAgent+'</p>';
//-->
</script>
</body>
</html>


0
0
收藏0
回帖

js获取用户浏览器信息 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息