navigator.userAgent안에 문자열을 파싱해서 알아 올수가 있다.
<script language="javascript">
var uAgent = navigator.userAgent.toLowerCase();
var mobilePhones = new Array('iphone','ipad','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>
출처 : http://genius3k.tistory.com/ 블로그 글중에서 발췌 |
|