如何用Javascript检测到所有的IE版本
function GetIEVersion() { var sAgent = window.navigator.userAgent; var Idx = sAgent.indexOf("MSIE");
// If IE, return version number. if (Idx > 0) return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));
// If IE 11 then look for Updated user agent string. else if (!!navigator.userAgent.match(/Trident/7./)) return 11;
else return 0; //It is not IE }
if (GetIEVersion() > 0) alert("This is IE " + GetIEVersion()); else alert("This is not IE."); |