UserAgent: obtains information about the user's browser and computer through a browser.

Source: Internet
Author: User

Description: The Chinese name of the User Agent is the User Agent (UA). It is a special string header, the server can identify the operating system and version, CPU type, browser and version, browser rendering engine, browser language, and browser plug-in used by the customer. Some websites often send different pages to different operating systems and browsers by judging the UA. Therefore, some pages may not be displayed normally in a browser, however, you can bypass detection by disguising UA. The standard format of UA string in www.2cto.com is: browser identifier (operating system identifier; encryption level identifier; browser LANGUAGE) rendering Engine logo version information browser logo because many websites ignore the two-digit version number during UA detection, it may cause the browser and later versions to receive bad pages, therefore, in Versions later than 10 of the browser, the browser identifier is fixed as the browser, and real version information is added at the end of the UA string. JAVA usage: [java] UserAgent userAgent = UserAgent. parseUserAgentString (request. getHeader ("User-Agent"); Browser browser = userAgent. getBrowser (); OperatingSystem OS = userAgent. getOperatingSystem (); you can obtain browsers of almost all systems, including mobile phones and tablets. This jar file is only 26KB in size and is very useful. If you want to learn more about advanced enum enumeration, you may wish to look at the source code. Some code:

Related Article

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.