var getOS = function(){
var sys = {};
var s = "";
var ua = navigator.userAgent.toLowerCase();
(s = ua.match(/msie ([\d.]+)/)) ? sys.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
if (sys.ie == "8.0") {
sys.IE8 = 1;
} else if (sys.ie == "7.0") {
sys.IE7 = 1;
} else if (sys.ie == "6.0") {
sys.IE6 = 1;
}
return sys;
}
alert((getOS().IE6));
javascript 判断浏览器版本
最新推荐文章于 2024-07-29 08:30:00 发布