js javascript 判斷瀏覽器類型

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 </head>

 <body>
  
<script> 
function getIEVersion() { 
   var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; //IE
   } else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; //火狐 
   } else if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; //Ipad瀏覽器 
   } else if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
        return "Camino"; 
   } else if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
        return "Gecko"; 
   } 
}
alert(getIEVersion());
</script>
 </body>
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章