Accept-CH Header
Table of Content
The Accept-CH
header is used by a server to indicate users' device and preference information that it wants from the client to better render and optimize the user experience. Also known as Client Hints, the Accept-CH
method helps servers make intelligent adjustments based on user-specific data, reducing latency and enhancing user engagement.
Syntax
Accept-CH: <directive>
Where <directive>
is one of the directives defined below.
Directives
DPR
Viewport-Width
Width
These are a few examples of the directives supported by theAccept-CH
header.DPR
stands for Device Pixel Ratio,Viewport-Width
represents the layout viewport width, andWidth
is the requested resource's expected width in CSS pixel.
Examples
To request Viewport-Width
and Width
information from the client, the server uses the following Accept-CH
header.
Accept-CH: Viewport-Width, Width
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Not Supported |
Safari | Not Supported |
Opera | Supported |
Edge | Supported |
How to modify Accept-CH header
The ModHeader Chrome extension provides a graphical tool for modifying request headers. Here's how to modify the Accept-CH
header using ModHeader:
- Add the ModHeader extension to your Chrome.
- Click on the ModHeader icon in your Chrome toolbar to open it.
- On the left panel, click on the '+' button to create a new header.
- In the 'Name' field, enter
Accept-CH
. - In the 'Value' field, enter the directive (e.g.,
Viewport-Width, Width
). - Hit 'Enter' to save.
The extension will ensure any subsequent HTTP requests initiated from your Chrome will include the modified Accept-CH
header. Its real value lies in its ability to allow for testing and debugging of server responses based on different client conditions.