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