js 判断浏览器类别

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_36422236/article/details/81392647

关于双核浏览器

国内主流浏览器多为双核浏览器,一个内核是Trident,然后再增加一个其他内核。一般把其他内核叫做“高速浏览模式”,而Trident则是“兼容浏览模式”,用户可以来回切换。

360安全浏览器主要是使用了 IE和WebKit双核心的浏览器

360极速浏览器主要是使用了 IE和Chrome双内核,并能自由切换,比较快。

js如何判断浏览器是什么内核

<SCRIPT LANGUAGE="JavaScript">
function btnlogin()
{
     if(navigator.userAgent.indexOf("MSIE")>0) {                                 // MSIE内核        
            return "MSIE"; 
        }
    if(navigator.userAgent.indexOf("Firefox")>0){                                 // Firefox内核       
            return "Firefox"; 
        }
    if(navigator.userAgent.indexOf("Opera")>0){                                  // Opera内核       
            return "Opera"; 
        }
    if(navigator.userAgent.indexOf("Safari")>0) {                                  // Safari内核       
            return "Safari";  
        } 
    if(navigator.userAgent.indexOf("Camino")>0){                                  // Camino内核       
            return "Camino"; 
        } 
    if(navigator.userAgent.indexOf("Gecko")>0){                                    // Gecko内核       
            return "Gecko"; 
        } 
}
</SCRIPT>



if (window.navigator.userAgent.indexOf("MSIE 7.0")>=1){                    //如果浏览器为IE7
         return "MSIE 7.0";
   }

if (window.navigator.userAgent.indexOf("MSIE 7.0")>=1){                    //如果浏览器为IE8
         return "MSIE 8.0";
}

if (window.navigator.userAgent.indexOf("MSIE 7.0")>=1){                    //如果浏览器为IE9
         return "MSIE 9.0";
}

猜你喜欢

转载自blog.csdn.net/sinat_36422236/article/details/81392647