1. Home
  2. Docs
  3. Script Snippet
  4. 모바일 기기 체크

모바일 기기 체크

모바일 기기를 체크해서 스크립트를 동작시키고자 하는 경우

ex) 모바일에선 링크를 제거하고, 클릭 시 메시지를 안내하기

<script>
jQuery(function ($) {

    var filter = "win16|win32|win64|mac|macintel";
    if (navigator.platform) {
        if (filter.indexOf(navigator.platform.toLowerCase()) < 0) {
            $('.action_only_pc')
                .removeAttr("href")
                .css("cursor", "pointer");
            $('.action_only_pc').click(function () {
                alert('모바일에서는 지원하지 않습니다.');
            });
        }
    }

});
</script>