Home >Web Front-end >JS Tutorial >Summary of methods for judging whether js is ie_javascript skills

Summary of methods for judging whether js is ie_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:03:551276browse

The third type of personal test is available below

First type:

Copy code The code is as follows:

if(window.addEventListener ){
alert("not ie");
}else if(window.attachEvent){
alert("is ie");
}else{
alert("This kind of This happens in older browsers that do not support DHTML (now generally supported)")
}

Second type:

Copy code The code is as follows:

if(document.all ){
alert("IE6");
}else{
alert("not ie");
}

Third type:

Copy code The code is as follows:

var navigatorName = "Microsoft Internet Explorer";
var isIE = false;
if( navigator.appName == navigatorName ){
isIE = true;
alert("ie")
}else{
alert("not ie")
}

Fourth method:

Copy code The code is as follows:

if(! [1 ,])alert("This is Internet Explorer");
else alert("This is not Internet Explorer");
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn