码迷,mamicode.com
首页 > 其他好文 > 详细

检测浏览器内核

时间:2017-08-05 13:15:25      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:dex   interval   ext   txt   src   int   charset   sys   tin   

打开即可检测浏览器版本信息:https://lanleilin.github.io/checkBrowser/index.html

window.onload=function(){
    txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
    txt+= "<p>Browser Name: " + navigator.appName + "</p>";
    txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
    txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
    txt+= "<p>Platform: " + navigator.platform + "</p>";
    txt+= "<p class=‘platform‘>User-agent header: " + navigator.userAgent + "</p>";
    txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";
    
    document.getElementById("example").innerHTML=txt;
    var isUcb=navigator.appVersion+‘‘;
    if(isUcb.indexOf(‘UCBrowser‘)>-1) {
        document.body.style.backgroundColor=‘#000000‘;
        document.body.style.color=‘#FFFFFF‘;
    }
    function setColor(){
        this.arr=[0,1,2,3,4,5,6,7,8,9,‘a‘,‘b‘,‘c‘,‘d‘,‘e‘,‘f‘];
        this.lanH1=document.getElementsByClassName(‘platform‘)[0];
        this.title=document.getElementById(‘title‘);
        this.color=‘#‘+
        this.arr[parseInt(Math.random()*16)]+
        this.arr[parseInt(Math.random()*16)]+
        this.arr[parseInt(Math.random()*16)]+
        this.arr[parseInt(Math.random()*16)]+
        this.arr[parseInt(Math.random()*16)]+
        this.arr[parseInt(Math.random()*16)];
        this.lanH1.style.color=this.color;
        this.title.style.color=this.color;
        
    }
    new setColor();
    clearInterval();
    setInterval(function(){
        new setColor();
    },10000);
}

html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="js/check.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
        <h1>浏览器 <span id="title">KERNEL</span> </h1>
        <p id="example"></p>
    </body>
</html>

 

检测浏览器内核

标签:dex   interval   ext   txt   src   int   charset   sys   tin   

原文地址:http://www.cnblogs.com/rlann/p/7289908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!