본문 바로가기
공부방/Java

접속환경이 모바일이면 index변경

by SmartCow 2021. 2. 13.
<script type="text/javascript">
    function indexFunc(){
        var mobileKey = new Array('iPhone', 'iPod', 'BlackBerry', 'Android', 'Windows CE', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson');
        for (var word in mobileKey){
            if (navigator.userAgent.match(mobileKey[word]) != null){
                window.location.href = "모바일주소.html";
                break;
            }
        }
    }
</script>

 

그 다음 body 함수에

<body onload="indexFunc()">

추가

'공부방 > Java' 카테고리의 다른 글

Tomcat server.xml 분석  (0) 2022.03.14
favicon.ico 에러  (0) 2021.03.01
SpringSecurity Authentication관련 클래스와 처리  (0) 2021.01.01
Request 객체  (0) 2020.12.20
web.xml 수동으로 추가하는 방법  (0) 2020.11.30