public class HttpDemo {
public static void main(String[] args) {
//模拟一段浏览器用户访问数据
String uaStr = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1";
UserAgent ua = UserAgentUtil.parse(uaStr);
ua.getBrowser().toString();//Chrome
ua.getVersion();//14.0.835.163
ua.getEngine().toString();//Webkit
ua.getEngineVersion();//535.1
ua.getOs().toString();//Windows 7
ua.getPlatform().toString();//Windows
//判断是否为移动端
ua.isMobile();
}
}
Last modification:August 1, 2022
© Allow specification reprint