-
javascript | navigator.userAgent 로 android/ios 구분하기카테고리 없음 2019. 11. 12. 08:38
거두절미하고..
var mobile = (/iphone|ipad|ipod|android/i.test(navigator.userAgent.toLowerCase()));
DOM Navigator는 브라우저에 대한 정보를 포함하고 있는 객체이다.
DOM 내장객체이기 때문에 별도로 선언하지 않아도 사용이 가능하다.
Navigator 가 제공하는 보다 더 많은 속성들은 https://www.w3schools.com/jsref/obj_navigator.asp 에서 확인 가능하다.