반응형
Javascript 로 PC / 모바일 환경을 구분해야하는 경우가 생김
기록하기 위해서 해당 내용을 공유함
<script>
let filter = "win16|win32|win64|mac|macintel";
if(0 > filter.indexOf(navigator.platform.toLowerCase())){
alert("Client platform : Mobile");
}
else{
alert("Client platform : PC");
}
</script>
해당 코드를 사용하면 PC / 모바일 구분하여 환경을 설정할 수 있다.
SMALL
반응형