function getBrowserInfo()
{
var ua = navigator.userAgent;
M = ua.match(/(opera | chrome | safari | firefox | msie | trident(?= /))/?\ s *([\ d。] +)/ i)|| [];
如果(/trident/i.test(M [1]))
{
tem = / \ brv [:] +(\ d +(。\ d +)?)/ g.exec(ua)|| [];
返回'IE'+(tem [1] ||'');
}
M = M [2]? [M [1],M [2]]:[navigator.appName,navigator.appVersion,' - ?'];
if((tem = ua.match(/ version /([。\ d] +)/ i))!= null)M [2] = tem [1];
返回M.join('');
}
警报(getBrowserInfo());
答案 0 :(得分:0)
浏览器类型
var browserType = navigator.appName;
alert('Browser type is: ' + browserType);
浏览器版本
var browserVersion = navigator.appVersion;
alert('Browser version is: ' + browserVersion);