javascript 浏览器类型和版本号检测代码(兼容多浏览器) 时间:2020-05-12 人气:0 javascript检测浏览器类型和版本号(兼容各浏览器) <script language="javascript" type="text/javascript"> var uA = navigator.userAgent; var browserType = "unknown"; if (uA.indexOf("Opera") > -1) { browserType = "Opera"; } else if (uA.indexOf("Safari") > -1) { browserType = "Safari"; } else if (uA.indexOf("Konqueror") > -1) { browserType = "Konqueror"; } else if (uA.indexOf("Gecko") > -1) { browserType = "Mozilla"; } else if (uA.indexOf("MSIE") > -1) { browserType = "Internet Explorer"; } //window.alert(browserType); document.write(browserType); document.write(" "); document.write(document.lastModified); //显示页面的修改日期 document.write(" "); document.write(navigator.userAgent); //显示客户端环境参数 document.write(" "); document.write("h,w:"+screen.availHeight+"x"+screen.availWidth+"pixels");//测定显示器大小 //显示器大小 function screenWH(){ var getscreen=document.getElementById('screenWH'); getscreen.value=screen.availHeight+"x"+screen.availWidth; var divscreen=document.getElementById('screensWH'); divscreen.value=screen.availHeight+"x"+screen.availWidth+"pixels"; //window.screen.height+"+"+window.screen.width; } </script> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]相关文章:javascript 检测浏览器类型和版本的代码javascript 浏览器检测代码精简版JavaScript 判断浏览器类型及版本 加载全部内容