js 获取浏览器类型和版本
function getExplore(){ var Sys = {}; var ua = navigator.userAgent.toLowerCase(); var s; (s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] : (s = ua.match(/msie ([\d\.]+)/)) ? Sys.ie = s[1] : (s = ua.match(/edge\/([\d\.]+)/)) ? Sys.edge = s[1] : (s = ua.match(/firefox\/([\d\.]+)/)) ? Sys.firefox = s[1] : (s = ua.match(/(?:opera|opr).([\d\.]+)/)) ? Sys.opera = s[1] : (s = ua.match(/chrome\/([\d\.]+)/)) ? Sys.chrome = s[1] : (s = ua.match(/version\/([\d\.]+).*safari/)) ? Sys.safari = s[1] : 0; // 根据关系进行判断 if (Sys.ie) return ('IE: ' + Sys.ie); if (Sys.edge) return ('EDGE: ' + Sys.edge); if (Sys.firefox) return ('Firefox: ' + Sys.firefox); if (Sys.chrome) return ('Chrome: ' + Sys.chrome); if (Sys.opera) return ('Opera: ' + Sys.opera); if (Sys.safari) return ('Safari: ' + Sys.safari); return 'Unkonwn'; } var browserVersion = getExplore(); //获取浏览器类型和版本
相关推荐
zaocha 2019-09-08
zhangpuego 2010-03-17
mixley 2019-06-28
山兔与孟婆 2019-11-06
zaocha 2019-11-04
李世平 2019-10-24
ilzxxx0 2015-11-14
玫瑰余香000 2012-05-13
yanjingtp 2019-03-08
ljqscdnljq 2014-01-20
lengyu0 2016-09-21
zebperfect 2011-04-25
yidaizongshi 2011-03-28
zzptojava天下 2013-04-16
zzptojava天下 2013-03-14
hudk 2012-09-25
zzptojava天下 2010-12-15