본문 바로가기
Programming/Web

스마트폰(모바일)용 웹 자동이동

by Chan_찬 2012. 1. 12.
728x90
반응형
<script type="text/javascript">
var ua = window.navigator.userAgent.toLowerCase();
if(/Android/.test(ua)||/iphone/.test(ua)
	||/iPod/.test(ua)||/PPC/.test(ua)) {
    document.location.replace('이동할경로');
}
</script>


<%
String browser = request.getHeader("User-Agent"); boolean result = false; if (browser.indexOf("Android") >0) { // 안드로이드 result = true; } else if (browser.indexOf("iphone","iPod","PPC") > 0) { // 아이폰등등.. result = true; } if (result == true) { response.sendRedirect("이동할경로"); } %>


<script type="text/javascript">
    var ua = window.navigator.userAgent.toLowerCase();
    if ( /iphone/.test(ua) || /android/.test(ua) 
		|| /opera/.test(ua) || /bada/.test(ua) ) {
        document.location.replace('이동할경로');
    }
</script>


<%
    mobrwz = "Android|iPhone|iPod|IEMobile|Mobile|lgtelecom|PPC"
    spmobrwz = split(spmobrwz,"|"
    agent = Request.ServerVariables("HTTP_USER_AGENT")
    For i = 0 to UBound(spmobrwz)
    If InStr(agent,spmobrwz(i)) > 0 Then
    Response.Redirect("이동할경로")
    Exit for
    End If
    Next
%>
728x90
728x90
BIG
Buy me a coffeeBuy me a coffee

댓글