Js to determine whether the method is ie summary
- 2020-03-30 01:19:06
- OfStack
The third kind of test is available
The first:
if(window.addEventListener){
alert("not ie");
}else if(window.attachEvent){
alert("is ie");
}else{
alert(" This happens in unsupported DHTML Older versions of browsers (now generally supported) ")
}
The second:
if(document.all){
alert("IE6");
}else{
alert("not ie");
}
The third:
var navigatorName = "Microsoft Internet Explorer";
var isIE = false;
if( navigator.appName == navigatorName ){
isIE = true;
alert("ie")
}else{
alert("not ie")
}
Fourth:
if(!+[1,])alert(" This is a ie The browser ");
else alert(" This is not ie The browser ");