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

ECT header

· 52CE 我爱测

The HTTP **`ECT`** request header is used in Client Hints to indicate the effective connection type: `slow-2g`, `2g`, `3g`, or `4g`.

The HTTP ECT request header is used in Client Hints to indicate the effective connection type: slow-2g, 2g, 3g, or 4g.

The value represents the "network profile" that best matches the connection's latency and bandwidth, rather than the actual mechanisms used for transferring the data. For example, 2g might be used to represent a slow Wi-Fi connection with high latency and low bandwidth, while 4g might represent a fast fiber-based broadband network.

The hint allows a server to choose what information is sent based on the broad characteristics of the network. For example, a server might choose to send smaller versions of images and other resources on less capable connections. The value might also be used as a starting point for determining what information is sent, which is further refined using information in RTT and Downlink hints.

[!NOTE] A server that specifies ECT in Accept-CH may also specify it in Vary to indicate that responses should be cached for different ECT values.

<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>No</td> </tr> </tbody> </table>

Syntax

ECT: <value>

Directives

  • <value>
    • : A value indicating effective connection type. Can be one of: slow-2g, 2g, 3g, or 4g.

Examples

A server first needs to opt in to receive the ECT header by sending the Accept-CH response header containing ECT.

Accept-CH: ECT

Then on subsequent requests the client might send an ECT header back:

ECT: 2g

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

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

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