728x90
반응형
String agent = request.getHeader("USER-AGENT");
String[] mobileos = {"iPhone","iPod","Android","BlackBerry","Windows CE",
"Nokia","Webos","Opera Mini","SonyEricsson","Opera Mobi","IEMobile"};
int j = -1;
for(int i=0;i<mobileos.length;i++){
j=agent.indexOf(mobileos[i]);
if(j>-1){
// 모바일로 접근했을 때
System.out.println("os - : "+agent);
break;
}
}
일반적으로 접근할 때
if(j==-1)response.sendRedirect("http://www.blank5space.com");
728x90