Accept-CH-Lifetime Header
Table of Content
- Syntax
- Directives
- Examples
- Browser Compatibility
- How to modify Accept-CH-Lifetime header The Accept-CH-Lifetime Header, originally designed around the Client Hints (CH) mechanism in web browsers, is deployed to guide how long the client should remember the provided Client Hints set by a host. Generally, hosts set the Client Hints and the configurations are stored for future requests. The purpose of this header is to limit the time such configurations are stored, improving browser performance and elevating user privacy.
Syntax
The syntax of Accept-CH-Lifetime header is as follows:
Accept-CH-Lifetime: <seconds>
The <seconds>
is the number of seconds the client should remember site settings for Client Hints.
Directives
The only directive for the Accept-CH-Lifetime header is the time value. This is expressed in seconds and depicts the time duration for which the client will remember the list of Client Hints set by the host.
Examples
Example 1
If you want the browser client to remember the Client Hints for a day:
Accept-CH-Lifetime: 86400
Example 2
To remember the settings for a week:
Accept-CH-Lifetime: 604800
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Not Supported |
Safari | Not Supported |
Opera | Supported |
Edge | Supported |
How to modify Accept-CH-Lifetime header
ModHeader is a browser extension only compatible with Chrome that allows you to modify both request and response headers in Chrome.
Follow the below steps to modify Accept-CH-Lifetime Header:
- Add the ModHeader extension to Chrome.
- After clicking the ModHeader icon, a form will appear.
- Select 'Response headers' from the drop-down list.
- In the input field that appears, type 'Accept-CH-Lifetime' in the name field.
- In the adjacent value field, input the duration in seconds according to your requirements.
- Save the settings.
For example, to remember the settings for one hour:
Name: Accept-CH-Lifetime
Value: 3600
This kind of modification is useful when testing Client Hints behavior for different durations or testing the performance of a web application with different Client Hints settings.