首页 > 代码库 > 传入http请求的UserAgent 根据它判断是手机还是电脑发送过来的请求
传入http请求的UserAgent 根据它判断是手机还是电脑发送过来的请求
- /**
- * 传入http请求的UserAgent
- * 根据它判断是手机还是电脑发送过来的请求
- * @param userAgent
- * @return
- */
- public static boolean choose(String userAgent) {
- if (userAgent.indexOf("Noki") > -1 || // Nokia phones and emulators
- userAgent.indexOf("Eric") > -1 || // Ericsson WAP phones and emulators
- userAgent.indexOf("WapI") > -1 || // Ericsson WapIDE 2.0
- userAgent.indexOf("MC21") > -1 || // Ericsson MC218
- userAgent.indexOf("AUR") > -1 || // Ericsson R320
- userAgent.indexOf("R380") > -1 || // Ericsson R380
- userAgent.indexOf("UP.B") > -1 || // UP.Browser
- userAgent.indexOf("WinW") > -1 || // WinWAP browser
- userAgent.indexOf("UPG1") > -1 || // UP.SDK 4.0
- userAgent.indexOf("upsi") > -1 || //another kind of UP.Browser
- userAgent.indexOf("QWAP") > -1 || // unknown QWAPPER browser
- userAgent.indexOf("Jigs") > -1 || // unknown JigSaw browser
- userAgent.indexOf("Java") > -1 || // unknown Java based browser
- userAgent.indexOf("Alca") > -1 || // unknown Alcatel-BE3 browser (UP based)
- userAgent.indexOf("MITS") > -1 || // unknown Mitsubishi browser
- userAgent.indexOf("MOT-") > -1 || // unknown browser (UP based)
- userAgent.indexOf("My S") > -1 ||// unknown Ericsson devkit browser
- userAgent.indexOf("WAPJ") > -1 ||//Virtual WAPJAG www.wapjag.de
- userAgent.indexOf("fetc") > -1 ||//fetchpage.cgi Perl script from www.wapcab.de
- userAgent.indexOf("ALAV") > -1 || //yet another unknown UP based browser
- userAgent.indexOf("Wapa") > -1 || //another unknown browser (Web based "Wapalyzer")
- userAgent.indexOf("Oper") > -1) {
- return true;
- } else {
- return false;
- }
- }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。