본문 바로가기

프로그래밍/Javascript

스마트폰 사이트 접속시 모바일웹 redirect 기법

<script type="text/javascript">
var uAgent = navigator.userAgent.toLowerCase();
var mobilePhones = new Array('iphone','ipod','android','blackberry','windows ce',
'nokia','webos','opera mini','sonyericsson','opera mobi','iemobile');
for(var i=0;i<mobilePhones.length;i++)
if(uAgent.indexOf(mobilePhones[i]) != -1)
document.location="모바일웹 주소";
</script>
 

 

'프로그래밍 > Javascript' 카테고리의 다른 글

iscroll  (0) 2012.06.21
모바일 웹 접속시 최적화  (0) 2012.06.20
슬라이딩  (0) 2012.05.10
입력제한  (0) 2012.04.12
ime-mode  (0) 2012.04.12