大网数据广告活动
Web 标准与前端开发

Critical-CH header

· 52CE 我爱测

The HTTP **`Critical-CH`** response header is used along with Accept-CH to identify the accepted client hints that are critical.

The HTTP Critical-CH response header is used along with Accept-CH to identify the accepted client hints that are critical.

User agents receiving a response with Critical-CH must check if the indicated critical headers were sent in the original request. If not, the user agent will retry the request along with the critical headers rather than render the page. This approach ensures that client preferences set using critical client hints are always used, even if not included in the first request, or following server configuration changes.

Each header listed in the Critical-CH header should also be present in the Accept-CH and Vary headers.

<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td> Response header </td> </tr> </tbody> </table>

Syntax

Critical-CH: <ch-list>

Directives

  • <ch-list>
    • : A list of one or more comma-delimited client hint headers that the server considers to be critical client hints.

Examples

The client makes an initial request to the server:

GET / HTTP/1.1
Host: example.com

The server responds, indicating via Accept-CH that it accepts Sec-CH-Prefers-Reduced-Motion. In this example, Critical-CH is also used to specify that Sec-CH-Prefers-Reduced-Motion is considered a critical client hint.

HTTP/1.1 200 OK
Content-Type: text/html
Accept-CH: Sec-CH-Prefers-Reduced-Motion
Vary: Sec-CH-Prefers-Reduced-Motion
Critical-CH: Sec-CH-Prefers-Reduced-Motion

[!NOTE] We've specified Sec-CH-Prefers-Reduced-Motion in the Vary header to indicate that responses should be separately cached based on the value of this header (even if the URL stays the same). Each header listed in the Critical-CH header should also be present in the Accept-CH and Vary headers.

The client automatically retries the request (due to Critical-CH being specified above), telling the server via Sec-CH-Prefers-Reduced-Motion that it has a user preference for reduced-motion animations:

GET / HTTP/1.1
Host: example.com
Sec-CH-Prefers-Reduced-Motion: "reduce"

The client will include the header in subsequent requests in the current session unless the Accept-CH changes in responses to indicate that it is no longer supported by the server.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。