ECT
ECT
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ECT
network client hint request header field indicates the effective connection type: slow-2g
, 2g
, 3g
, 4g
.
Header type | Request header, Client hint |
---|---|
Forbidden header name | no |
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 wifi connection with high latency and low bandwidth, while 4g
might be used to represent a fast fibre-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.
Syntax
ECT: <value>
Directives
- <value>
-
A value indicating effective connection type. This is one of:
slow-2g
,2g
,3g
, or4g
.
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
Specification |
---|
Network Information API # ect-request-header-field |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
ECT |
67 |
≤79 |
? |
? |
54 |
? |
67 |
67 |
? |
48 |
? |
9.0 |
See also
- Adapting to Users with Client Hints (developer.google.com)
- Network client hints
Accept-CH
-
HTTP Caching > Varying responses and
Vary
NetworkInformation.effectiveType
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ECT