<script>
var filter = "win16|win32|win64|mac";
if(navigator.platform) {
if(filter.indexOF(navigator.platform.toLowerCase()) < 0)
//모바일
} else {
//pc
}
}
</script>
------------------------------------------------------------------------
<?
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
//모바일인지 체크합니다.
if(MobileCheck() == "Mobile"){
echo"현재 휴대폰으로 접속했습니다.";
}else{
echo"현재 컴퓨터로 접속했습니다.";
}
?>
--------------------------------------------------------------------------