if( navigator.appName.indexOf("Microsoft") > -1 ) // IE?
{
if( navigator.appVersion.indexOf("MSIE 6") > -1) // IE6?
{
// code
}
else if( navigator.appVersion.indexOf("MSIE 7") > -1) // IE7?
{
// code
}
}
출처 - http://www.dezrare.com/604
===================================================================================
1. 브라우저 헤더정보
<script language="javascript">
function userAgent()
{
var browserType = "";
if(navigator.userAgent.indexOf("MSIE") != -1)
{
browser = "IE";
return browserType;
}
if(navigator.userAgent.indexOf("Firefox") != -1)
{
browser = "FF";
return browserType;
}
if(navigator.userAgent.indexOf("Mozilla") != -1)
{
browser = "MZ";
return browserType;
}
if(navigator.userAgent.indexOf("Opera") != -1)
{
browser = "OP";
return browserType;
}
if(navigator.userAgent.indexOf("Safari") != -1)
{
browser = "SF";
return browserType;
}
if(navigator.userAgent.indexOf("Mac") != -1)
{
browser = "MC";
return browserType;
}
browser = "NG";
return browserType;
}
</script>
2. 객체존재여부
<script language="javascript">
function userAgent()
{
if(window.ActiveXobject){
browser = "IE";
return browserType;
}
else {
browser = "NG";
return browserType;
}
}
</script>
출처: http://blog.naver.com/cowboy0626/30007053474
'Development > JavaScript' 카테고리의 다른 글
javaScript/node.js - 날짜 표현 util(date-utils) (0) | 2012.09.03 |
---|---|
javascript - RSA 로 암호화 로그인 (1) | 2012.07.30 |
브라우저 중앙 위치에서 팝업 띄우기 (0) | 2012.07.04 |
javascript - setTimeout, setinterval (0) | 2012.07.01 |
javascript - 정규 표현식(Regular Expression) (1) | 2012.06.21 |