it/JavaScript

IE 버전 구별.

하얀나다 2017. 9. 1. 10:29

참조 : http://ooz.co.kr/67


function isIE () {

 var myNav = navigator.userAgent.toLowerCase();

 

 if ((navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1) || (myNav.indexOf("msie") != -1) ) {

    if(myNav.indexOf("msie") != -1){

//alert("10이전버전이군");

                                        //parseInt(myNav.split('msie')[1]) //몇버전인지 궁금하면..

    return 1; //ie10 이전버전

}else if(navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1){

//alert("11버전이군");

return 2; //ie11

}else{

                                         //혹시나 모를..

//alert("오류군");

return 3; //오류

}

 }  

 return 0;

}



if(isIE ()<= 1){}

else{

}