자동적으로 모바일용 페이지로 연결시키는 소스
접속자 정보인 HTTP_USER_AGENT 안에 모바일 관련 내용이 있으면
모바일 페이지로 접속시키는 소스이다.
ASP 소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | Dim mobile, n, strAgent If (Len(Request.ServerVariables("HTTP_USER_AGENT"))=0) Then     strAgent = "NONE" Else     strAgent = Request.ServerVariables("HTTP_USER_AGENT") End If mobile = Array("iPhone", "ipad", "ipod""BlackBerry", "Android", "Windows CE", "LG", "MOT", "SAMSUNG", "SonyEricsson", "Mobile","Symbian","Opera Mobi","Opera Mini","IEmobile","Mobile","lgtelecom","PPC") Dim i i = 0 For Each n In mobile     If (InStr(LCase(strAgent), LCase(n)) > 0) Then         response.redirect "http://m.co.kr"         break     End If Next  | cs | 
JavaScript 소스
1 2 3 4 5 6 7 8 9 10 11  | <script type="text/javascript" language="JavaScript">     var mobileKeyWords = new Array('iPhone', 'iPod', 'BlackBerry', 'Android', 'Windows CE', 'Windows CE;', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson', 'Mobile', 'Symbian', 'Opera Mobi', 'Opera Mini', 'IEmobile');     for (var word in mobileKeyWords){         if (navigator.userAgent.match(mobileKeyWords[word]) != null){             window.location.href = "http://m.co.kr";             break;         }     } </script>  | cs | 
PHP 소스
1 2 3 4 5 6 7 8 9 10 11 12 13  | <? php     $mobileKeyWords = array ('iPhone', 'iPod', 'BlackBerry', 'Android', 'Windows CE', 'Windows CE;', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson', 'Mobile', 'Symbian', 'Opera Mobi', 'Opera Mini', 'IEmobile');     for($i = 0 ; $i < count($mobileKeyWords) ; $i++)     {         if(strpos($_SERVER['HTTP_USER_AGENT'],$mobileKeyWords[$i]) == true)         {             header("Location: http://m.co.kr");             exit;         }     } ?>  | cs |