코딩/JavaScript
javascript 모바일체크 방법
모바일 기기 체크하기 navigator.userAgent는 웹 브라우저에서 사용중인 유저에이전트(user Agent)를 반환한다 유저에이전트는 클라이언트가 서버에 요청할때 전달하는 정보이다 브라우저 버전 등 클라이언트 정보를 담고 있다 function isMobile() { var userAgent = navigator.userAgent; var mobile = /(iPhone|iPad|Android|BlackBerry|Windows Phone)/i.test(userAgent); return mobile; } if (isMobile()) { document.write("모바일."); } else { document.write("모바일 아님."); }