익스플로러 버전 구분 javascript
function get_version_of_IE (){
var word;
var version = "N/A";
var agent = navigator.userAgent.toLowerCase();
var name = navigator.appName;
// IE old version ( IE 10 or Lower )
if ( name == "Microsoft Internet Explorer" ) word = "msie ";
else {
// IE 11
if ( agent.search("trident") > -1 ) word = "trident/.*rv:";
// Microsoft Edge
else if ( agent.search("edge/") > -1 ) word = "edge/";
}
var reg = new RegExp( word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})" );
if ( reg.exec( agent ) != null ) version = RegExp.$1 + RegExp.$2;
return version;
}
var verString = get_version_of_IE();
var verNumber = parseInt ( get_version_of_IE() , 10 );
if(verString != "N/A"){
if(verNumber < 9){
//document.body.className+='lte7';
document.body.setAttribute('class', 'old-ie ie'+verNumber);
}
}
var word;
var version = "N/A";
var agent = navigator.userAgent.toLowerCase();
var name = navigator.appName;
// IE old version ( IE 10 or Lower )
if ( name == "Microsoft Internet Explorer" ) word = "msie ";
else {
// IE 11
if ( agent.search("trident") > -1 ) word = "trident/.*rv:";
// Microsoft Edge
else if ( agent.search("edge/") > -1 ) word = "edge/";
}
var reg = new RegExp( word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})" );
if ( reg.exec( agent ) != null ) version = RegExp.$1 + RegExp.$2;
return version;
}
var verString = get_version_of_IE();
var verNumber = parseInt ( get_version_of_IE() , 10 );
if(verString != "N/A"){
if(verNumber < 9){
//document.body.className+='lte7';
document.body.setAttribute('class', 'old-ie ie'+verNumber);
}
}
function detectIE(){
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if(msie > 0){
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}
var trident = ua.indexOf('Trident/');
if(trident > 0){
var rv = ua.indexOf('rv:');
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
}
var edge = ua.indexOf('Edge/');
if(edge > 0){
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
}
return false;
}
var verNumber = parseInt(detectIE(),10);
if(verNumber < 9){
document.body.setAttribute('class', 'old-ie ie'+verNumber);
}
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if(msie > 0){
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}
var trident = ua.indexOf('Trident/');
if(trident > 0){
var rv = ua.indexOf('rv:');
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
}
var edge = ua.indexOf('Edge/');
if(edge > 0){
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
}
return false;
}
var verNumber = parseInt(detectIE(),10);
if(verNumber < 9){
document.body.setAttribute('class', 'old-ie ie'+verNumber);
}
익스플로러 버전 구분 javascript
Reviewed by Unknown
on
오후 4:29
Rating:
댓글 없음: