관리 메뉴

moozi

모바일체크 javascript 본문

TIS_2016/HTML5_1기

모바일체크 javascript

moozi 2016. 3. 11. 15:07

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
       
        <script type="text/javascript">
            function detectmob() {
                 if( navigator.userAgent.match(/Android/i)
                 || navigator.userAgent.match(/webOS/i)
                 || navigator.userAgent.match(/iPhone/i)
                 || navigator.userAgent.match(/iPad/i)
                 || navigator.userAgent.match(/iPod/i)
                 || navigator.userAgent.match(/BlackBerry/i)
                 || navigator.userAgent.match(/Windows Phone/i)
                 ){
                    location.href="mobile_index.html";
                  }
                 else {
                    location.href="pc_index.html";
                 }
            }
         </script>
       
    </head>
    <body onload="detectmob()">
        <p>모바일 접속 체크</p>
       
               
               
               
               
               
               
               
    </body>
</html>

 

'TIS_2016 > HTML5_1기' 카테고리의 다른 글

포트폴리오1차 제출  (17) 2016.03.14
구글맵 마커, infowindow 추가하기  (0) 2016.03.11
자바스크립트 연습문제2  (0) 2016.03.10
자바스크립트 연습문제1  (0) 2016.03.09
3/9 오후 자바스크립트  (0) 2016.03.09
Comments