function isMobilePadCheckByAgent() { static $UACheck; if(isset($UACheck)) { return $UACheck; } // $padAgent = array('iPad','SM-P550', 'Android', 'webOS', 'hp-tablet', 'PlayBook'); $padAgent = array('iPad','SM-P550','Android','webOS', 'hp-tablet', 'PlayBook'); // Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device. // $exceptionAgent[0] contains exception agents for all exceptions. $exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile'); foreach($padAgent as $agent) { if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) { if(!isset($exceptionAgent[$agent])) { $UACheck = TRUE; return TRUE; } elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) { // If the agent is the Android, that can be either tablet and mobile phone. foreach($exceptionAgent[0] as $val) { if(strpos($_SERVER['HTTP_USER_AGENT'], $val) !== FALSE) { $UACheck = FALSE; return FALSE; } } $UACheck = TRUE; return TRUE; } } } $UACheck = FALSE; return FALSE; }
Mobile.class.php 에서 에이전트가 안드로이드일때 타블렛 과 스마트폰을 구별을 하려고
하는데 이것 웬지 안되는것 같습니다. 제가 노트 5 와 갤러시탭 A를 쓰는데
모바일에서 접속시 노트 5에서는 모바일 화면이 갤럭시탭 A 에서는 첫화면이 PC화면으로 초기화면을
지정하고 싶습니다. ...
일일히 모델명이나 식별자 등을 추가하는 방법이 있기는 합니다만 이 방법으로는 한계가 있습니다.(태블릿이나 폰이 한두개여야죠.. 게다가 브라우저별로 유저 에이전트도 다르고 기본 브라우저가 아닌이상 모델명이 꼭 있으리라는 법도 없습니다.)
즉 구분하기 힘듭니다...
굳이 구분할 필요 없이 네이버처럼(PC에서 m.naver.com으로 접속시 태블릿 화면이 뜨는데 여기서 창을 줄이면 모바일 페이지가 보입니다) 모바일 페이지를 따로 반응형으로 만드는 방법 정도가 있겠습니다.(즉 PC 레이아웃은 그대로 두고 모바일만 반응형으로 작업)