格 千格 KiloCell

User Agent Parser

Your current User Agent
...

Deep parsing: User Agent's role on the Internet

User Agen (UA) is a special stringhead with a browser at each HTTP Request sent to server. It tells the server about your browser type, version number, operating system, rendering engine and equipment type. By deciphering the string, the website provides better compatibility and personalization experiences.

Why does the developer need to parse User Agent?

  • Response design and equipment identification: Distinguishing between users on mobile phones, tablets or computers, thereby loading different layouts and resources.
  • Compatibility treatment: Apply a specific CSS patch or Polyfill for an old version of browser (e. g. IE).
  • Statistics and analysis: To get a technical picture of the visitors and optimize the development of the website.
  • Safety protection: Identify and intercept unusual reptile requests or forged UAs to prevent malicious attacks.

Typical structure for User Agen

Although the UA string appears to be unwieldy, it usually follows certain norms. For example, most modern browsers UA are used to create a new user-friendly web site. Mozilla/5.0 This begins with the purpose of preserving historical compatibility. It will then contain information about the operating system (e.g., Windows NT 10.0; Win64; x64 ) and render engine information (e. g.) AppleWebKit/537.36 )。

How do you simulate different User Agents for testing?

In the Chrome Browser, you can press F12 Opens the developer tool, clicks on three points in the top right corner More tools → Network conditions , uncheck Use browser default , you can select or customize UA in the dropdown menu. This is very useful for testing the effects of moving-end displays.