The useragent of the incoming HTTP request is based on whether the phone or the computer sent the request.

Source: Internet
Author: User

    1. /**
    2. * UserAgent of incoming HTTP requests
    3. * Depending on whether it is a phone or a computer sent over the request
    4. * @param useragent
    5. * @return
    6. */
    7. public < span class= "keyword" style= "color: #7f0055; Font-weight:bold; " >static boolean choose (string  useragent)  {  
    8.      if  (Useragent.indexof ( "Noki")  > -1 | |  //  nokia phones and emulators  
    9.              Useragent.indexof (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 (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. }
    34. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.