java判断请求设备类型(ipad,iphone,android,windows)

判断是移动端还是pc端
tablet是平板电脑

    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;
    }

你可能感兴趣的:(iphone,java,ipad)