1. iPhone/iPad User Agent
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; ko-kr)
AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5
Mozilla/5.0 (iPad; U; CPU iPhone OS 4_2_1 like Mac OS X; ko-kr)
AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5
2. Android 계열
- 갤럭시S
Mozilla/5.0 (Linux; U; Android 2.2.1; ko-kr; SHW-M110S Build/FROYO)
AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
- HTC 디자이어
Mozilla/5.0 (Linux; U; Android 2.2; ko-kr; HTC_DesireHD_A9191 Build/FRF91)
AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Sample Code 1)
<%--
- Description : 단말기종 체크1
--%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device=width,user-scalable=no,initial-scale=1.0,maximum-scale=3.0" />
<title>단말기종 체크</title>
<style>
article, aside, figure, footer, header, hgroup, memu, nav, section { display: block; }
p { font-size: 12px; }
</style>
<script>
var ua = navigator.userAgent;
//iPhone 3.x?
if(ua.indexOf("iPhone OS 3") > 0) {
alert("iPhone 3.x 입니다.");
}
//iPhone 4.x?
else if(ua.indexOf("iPhone OS 4") > 0) {
alert("iPhone 4.x 입니다.");
}
//iPad ?
else if(ua.indexOf("iPad") > 0) {
alert("iPad 입니다.");
}
//Android 1.6 ?
else if(ua.indexOf("Android 1.6") > 0) {
alert("Android 1.6 입니다.");
}
//Android 2.1 ?
else if(ua.indexOf("Android 2.1") > 0) {
alert("Android 2.1 입니다.");
}
//Android 2.2 ?
else if(ua.indexOf("Android 2.2") > 0) {
alert("Android 2.2 입니다.");
}
//Android 2.3 ?
else if(ua.indexOf("Android 2.3") > 0) {
alert("Android 2.3 입니다.");
}
//Android 2.2 ?
else {
alert("버전이 확인되지 않습니다.");
}
</script>
</head>
<body>
<p>오늘은 맑음</p>
<p>오늘은 참 즐거운 날이었다.</p>
</body>
</html>
댓글 없음:
댓글 쓰기