傳入http請求的UserAgent 根據它判斷是手機還是電腦發送過來的請求

來源:互聯網
上載者:User

標籤:style   class   java   http   tar   color   

    1. /** 
    2.  * 傳入http請求的UserAgent 
    3.  * 根據它判斷是手機還是電腦發送過來的請求 
    4.  * @param userAgent 
    5.  * @return 
    6.  */  
    7. public static boolean choose(String userAgent) {  
    8.     if (userAgent.indexOf("Noki") > -1 || // Nokia phones and emulators  
    9.             userAgent.indexOf("Eric") > -1 || // Ericsson WAP phones and emulators  
    10.             userAgent.indexOf("WapI") > -1 || // Ericsson WapIDE 2.0  
    11.             userAgent.indexOf("MC21") > -1 || // Ericsson MC218  
    12.             userAgent.indexOf("AUR") > -1  || // Ericsson R320  
    13.             userAgent.indexOf("R380") > -1 || // Ericsson R380  
    14.             userAgent.indexOf("UP.B") > -1 || // UP.Browser  
    15.             userAgent.indexOf("WinW") > -1 || // WinWAP browser  
    16.             userAgent.indexOf("UPG1") > -1 || // UP.SDK 4.0  
    17.             userAgent.indexOf("upsi") > -1 || //another kind of UP.Browser  
    18.             userAgent.indexOf("QWAP") > -1 || // unknown QWAPPER browser  
    19.             userAgent.indexOf("Jigs") > -1 || // unknown JigSaw browser  
    20.             userAgent.indexOf("Java") > -1 || // unknown Java based browser  
    21.             userAgent.indexOf("Alca") > -1 || // unknown Alcatel-BE3 browser (UP based)  
    22.             userAgent.indexOf("MITS") > -1 || // unknown Mitsubishi browser  
    23.             userAgent.indexOf("MOT-") > -1 || // unknown browser (UP based)  
    24.             userAgent.indexOf("My S") > -1 ||//  unknown Ericsson devkit browser   
    25.             userAgent.indexOf("WAPJ") > -1 ||//Virtual WAPJAG www.wapjag.de  
    26.             userAgent.indexOf("fetc") > -1 ||//fetchpage.cgi Perl script from www.wapcab.de  
    27.             userAgent.indexOf("ALAV") > -1 || //yet another unknown UP based browser  
    28.             userAgent.indexOf("Wapa") > -1 || //another unknown browser (Web based "Wapalyzer")  
    29.             userAgent.indexOf("Oper") > -1) {  
    30.         return true;  
    31.     } else {  
    32.         return false;  
    33.     }  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.