새소식

🏫 TECH/🖼️ Front

[javascript] 웹페이지 접속 기기가 PC인지 모바일인지 판단하는 방법

728x90

👉 웹페이지 접속 기기가 PC인지 모바일인지 판단하는 방법?

👉 Please refer to the code below

function fn_test() { // 웹인지 모바일인지 체크 var filter = "win16|win32|win64|macintel|mac"; if(navigator.platform) { if(filter.indexOf(navigator.platform.toLowerCase()) < 0) { // mobile alert('핸드폰에서 접속!'); } else { // PC alert('PC에서 접속!'); } } }

 

If I was of any help to you, please buy me coffee 😿😢😥

If you have any questions, please leave them in the comments

[1] reference : https://doctorson0309.tistory.com/

[2] Ads : https://play.google.com/store/apps/details?id=io.cordova.seoulfilter

반응형

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.