'자바스크립트 모바일 구분'에 해당되는 글 1건

  1. 2014.05.26 [Javascript] - 자바스크립트 모바일 기기 구분

[Javascript] - 자바스크립트 모바일 기기 구분

Javascript 2014. 5. 26. 19:54
반응형

var uAgent = navigator.userAgent.toLowerCase();

var mobilePhones = new Array('iphone','ipod','android','blackberry','windows ce',

                             'nokia','webos','opera mini','sonyericsson','opera mobi','iemobile');


for(var i=0;i<mobilePhones.length;i++) {

  if(uAgent.indexOf(mobilePhones[i]) != -1) {

    console.log( mobilePhones[i] );

  }

}

반응형
: