Sec-CH-UA Header
Table of Content
The Sec-CH-UA header, also known as User-Agent Client Hints header, is a mechanism that enables developers to access detailed information about the user's browser and device. Its main purpose is to facilitate content negotiation, so developers can serve different types of content based on the client’s capabilities. This allows for more precise rendering and an overall better user experience.
Syntax
Sec-CH-UA: ";Not A Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"
Directives
Sec-CH-UA does not have any specific directives. The directives in the syntax above refer to the browser brands and their corresponding versions.
Examples
If a client wishes to identify itself as a particular version of Google Chrome, it might send headers resembling the following:
Sec-CH-UA: " Not A Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Not Supported |
Safari | Not Supported |
Opera | Supported |
Edge | Supported |
How to modify Sec-CH-UA header
ModHeader is a chrome extension that can modify HTTP requests. This can be useful to test and debug applications by imitating different browser versions and user agent strings.
For example, to modify the Sec-CH-UA header, you'll need to follow these steps:
- Install the ModHeader extension from the Chrome Web Store.
- Click on the ModHeader icon in the toolbar to open the extension.
- In the 'Response Headers' section, click the 'Add' button.
- In the 'Header name' field, enter "Sec-CH-UA".
- In the 'Header value' field, enter your desired user agent string, for example, " Not A Brand";v="99", "Chromium";v="90", "Google Chrome";v="90".
- Save your changes.
Now ModHeader will modify each HTTP request’s Sec-CH-UA header accordingly. This way, you can mimic the behavior of different browser versions or even entirely different browsers, helping you ensure your application functions properly across a wide range of user agents.