티스토리 뷰

카테고리 없음

모바일 agent

James Wetzel 2013. 11. 18. 15:59
728x90
반응형

<script language="javascript">

<!--

//스마트폰으로 접근 시 모바일 페이지로 이동.

var locationReferer = window.location.href.split("?");

var objAgent = 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 (objAgent.indexOf(mobilePhones[i]) != -1) {

if (locationReferer[1] != "Mobile")

document.location = "<%=ViewData["MobileUrl"] %>";

}

}

//-->

</script>

728x90
반응형