java 判断用户是PC端和还是APP端登陆
public void getRequestHeader(HttpServletRequest request){
// 从浏览器获取请求头信息
String info= request.getHeader("user-agent");
if(info.contains("Windows")){
System.out.println("Windows pc端登陆");
return;
}
if(info.contains("Macintosh")){
System.out.println("Mac pc端登陆");
return;
}
if(info.contains("Android")) {
System.out.println("Android移动客户端");
return;
}
if(info.contains("iPhone")) {
System.out.println("iPhone移动客户端");
return;
}
if(info.contains("iPad")) {
System.out.println("iPad客户端");
return;
}
System.out.println("其他客户端");
}