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

WBOY
Release: 2016-05-16 17:03:55
Original
1227 people have browsed it

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");
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template