Critical-CH Header

Table of Content

  • Syntax
  • Directives
  • Examples
  • Browser Compatibility
  • How to modify Critical-CH header The Critical-CH header is a server response header used in HTTPs that provides the functionality to enable Client Hints for subsequent requests made by the user's browser to the server. This allows clients to reveal details about their capabilities or preferences to the server so the server can provide an optimized user experience by customizing the response based on the data supplied by the hints.

Syntax

Critical-CH: <directive> [, <directive>]*

Directives

The directives for Critical-CH header are key-value pairs separated by commas in the structure <key>,<value> where each key is a client hint request eg. device-memory, width, viewport-width, etc.

Examples

An example of how to use the Critical-CH header is:

Critical-CH: device-memory

This will inform the browser to send the device-memory hint in its subsequent requests, allowing the server to make optimizations based on the device's memory capabilities.

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Not Supported
Safari Not Supported
Opera Supported
Edge Supported

How to modify Critical-CH header

The ModHeader Chrome extension is useful for modifying HTTP request and response headers. It can be used to modify the Critical-CH header as follows:

  1. Install the ModHeader extension in your Chrome browser.
  2. Click the ModHeader icon in the toolbar to open the extension.
  3. In the 'Response headers' section, click 'Add response header'.
  4. Input 'Critical-CH' in the 'Name' field and your directives in the 'Value' field. For example, write device-memory if you want to simulate how the header would operate for a device with specific memory.
  5. Now, each time you make an HTTP request from your browser, the response will include the modified Critical-CH header.

Modifying the header is helpful for debugging. You can test how your server responds to different client hint configurations without having to rely on changing client settings.