4,552,280 th visitor since 2017.2.1 ( Today : 53 )
Programming
No. 673
Name. swindler
Subject. 모바일 페이지 분기용 스크립트
Main Cate. Javascript
Sub Cate.
Date. 2010-03-08 10:58
Hit. 5067 (211.36.27.8)
File.


<script language="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 = "http://"+ location.host +"/m" + location.pathname;
</script>



jsp 나 java 에서는

String bVer = request.getHeader("User-Agent");

뭐 저런걸로
'iphone','ipod','android','blackberry','windows ce',
'nokia','webos','opera mini','sonyericsson','opera mobi','iemobile'

이 값들이 있나 찾으면 됩니다.


[바로가기 링크] : http://coolx.net/cboard/develop/673



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog