• notice
  • Congratulations on the launch of the Sought Tech site

Java judges the request device type (ipad, iphone, android, windows)

Judging whether it is a mobile terminal or a PC terminal
tablet is a tablet computer

   public  String clientType(HttpServletRequest request) {
       String agent = request.getHeader("User-Agent").toLowerCase();
       if (agent.indexOf("ipad") > -1 || agent.indexOf("android") > -1 || agent.indexOf("iphone") > -1
             || agent.indexOf("tablet") > -1)  
           return mobileTerminal;
       else
           return pcTerminal;
   }


Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+