<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script type="text/javascript">
var Browser = {
a : navigator.userAgent.toLowerCase()
}
Browser = {
ie : /*@cc_on true || @*/ false,
ie6 : Browser.a.indexOf('msie 6') != -1,
ie7 : Browser.a.indexOf('msie 7') != -1,
ie8 : Browser.a.indexOf('msie 8') != -1,
opera : !!window.opera,
safari : Browser.a.indexOf('safari') != -1,
safari3 : Browser.a.indexOf('applewebkit/5') != -1,
mac : Browser.a.indexOf('mac') != -1,
chrome : Browser.a.indexOf('chrome') != -1,
firefox : Browser.a.indexOf('firefox') != -1
}
function whatKindOfBrowser() {
if (Browser.chrome) {
alert("It is chrome browser");
} else if (Browser.ie6) {
alert("It is ie6 browser");
} else if (Browser.ie7) {
alert("It is ie7 browser");
} else if (Browser.ie8) {
alert("It is ie8 browser");
} else if (Browser.opera) {
alert("It is opera browser");
} else if (Browser.safari) {
alert("It is safari browser");
} else if (Browser.safari3) {
alert("It is safari3 browser");
} else if (Browser.mac) {
alert("It is mac browser");
} else if (Browser.firefox) {
alert("It is firefox browser");
} else {
alert("It is maybe ie");
}
}
</script>
</head>
<body>
<input type="button" value="브라우저 체크" onclick="javascript:whatKindOfBrowser();" />
</body>
</html>
[출처] 자바스크립트 브라우저 종류 체크|작성자 자몽
'Web Progreming' 카테고리의 다른 글
[ linux ] 프로세스관리 (0) | 2011.12.16 |
---|---|
[ jQuery ] 퀵메뉴 슬라이딩 스크립트 (0) | 2011.11.28 |
[ JavaScript ]사업자 등록번호 유효성검사 (0) | 2011.08.16 |
[ JavaScript ] KeyCode (0) | 2011.07.06 |
[ JavaScript ] 화면 가운데 새창 띄우기 (0) | 2011.07.06 |