답변 3개
</p>
<pre>
<code>if ($_SERVER['HTTP_X_REQUESTED_WITH'] == "your.app.id") {
//webview
} else {
//browser
}</code>
</pre>
<p><code>
입니다.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
자바스크립트로 가능하세요.
아래 예 몇개 올립니다.
구글 검색으로도 많이 확인가능하실거예요.
https://www.google.com/search?q=javascript+smartphone+check&oq=javascript+smartphone+check&aqs=chrome..69i57j0l2.6510j0j7&sourceid=chrome&ie=UTF-8">https://www.google.com/search?q=javascript+smartphone+check&oq=javascript+smartphone+check&aqs=chrome..69i57j0l2.6510j0j7&sourceid=chrome&ie=UTF-8
모바일기기 체크
예1)
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
){
// some code..
}
예2)
function isMobile(){
var UserAgent = navigator.userAgent;
if (UserAgent.match(/iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson/i) != null || UserAgent.match(/LG|SAMSUNG|Samsung/) != null)
{
return true;
}else{
return false;
}
}
if(isMobile()){
location.href = "/mobile/index.html"; //모바일페이지
}else{
location.href = "/main.html"; //PC용 페이지
}
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인