标签:indexof sed == int cap use app ret ie浏览器
function IEVer(){
var rv = -1;
if (navigator.appName == ‘Microsoft Internet Explorer‘){
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null){
rv = parseFloat( RegExp.$1 );
}
}else if (navigator.appName == ‘Netscape‘){
var ua = navigator.userAgent;
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null){
rv = parseFloat( RegExp.$1 );
}
}
return rv;
}
var IEVer = IEVer();
// 若是11 则返回11 ,若是其他版本则返回-1
// edge判断
var userAgent = navigator.userAgent;
var isEdge = userAgent.indexOf("Edge")>-1;
标签:indexof sed == int cap use app ret ie浏览器
原文地址:http://www.cnblogs.com/wszym111/p/7464007.html