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

Sec-CH-Prefers-Reduced-Transparency header

· 52CE 我爱测

The HTTP **`Sec-CH-Prefers-Reduced-Transparency`** request header is a user agent client hint that indicates the user agent's preference for reduced transparency.

The HTTP Sec-CH-Prefers-Reduced-Transparency request header is a user agent client hint that indicates the user agent's preference for reduced transparency.

If a server signals to a client via the Accept-CH header that it accepts Sec-CH-Prefers-Reduced-Transparency, the client can then respond with this header to indicate the user's preference for reduced transparency. The server can send the client appropriately adapted content — for example, CSS or images — to reduce the transparency of the content.

This header is modeled on the @media/prefers-reduced-transparency media query.

<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td> Request header, <a href="/en-US/docs/Web/HTTP/Guides/Client_hints">Client hint</a> </td> </tr> <tr> <th scope="row">Forbidden request header</th> <td>Yes (<code>Sec-</code> prefix)</td> </tr> </tbody> </table>

Syntax

Sec-CH-Prefers-Reduced-Transparency: <preference>

Directives

  • <preference>
    • : The user agent's preference for reduced transparency. This is often taken from the underlying operating system's setting. The value of this directive can be either no-preference or reduce.

Examples

Using Sec-CH-Prefers-Reduced-Transparency

The client makes an initial request to the server:

GET / HTTP/1.1
Host: example.com

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

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

[!NOTE] We've also specified Sec-CH-Prefers-Reduced-Transparency in the Vary header, to indicate to the browser that the served content will differ based on this header value — even if the URL stays the same — so the browser shouldn't just use an existing cached response and instead should cache this response separately. 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-Transparency that it has a user preference for reduced transparency:

GET / HTTP/1.1
Host: example.com
Sec-CH-Prefers-Reduced-Transparency: "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

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

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