The
Save-Data
header field is a boolean which, in requests, indicates the client's preference for reduced data usage. This could be for reasons such as high transfer costs, slow connection speeds, etc.A value of
On
indicates explicit user opt-in into a reduced data usage mode on the client, and when communicated to origins allows them to deliver alternative content to reduce the data downloaded such as smaller image and video resources, different markup and styling, disabled polling and automatic updates, and so on.Syntax
Save-Data: <sd-token>
Directives
- <
sd-token> - A numerical value indicating whether the client wants to opt in to reduced data usage mode.
onindicates yes, whileoff(the default) indicates no.
Examples
The
Vary
header ensures that the content is cached properly (for instance ensuring that the user is not served a lower-quality image from the cache when Save-Data
header is no longer present [e.g.
after having switched from cellular to Wi-Fi]).With
Save-Data: on
Request:
GET /image.jpg HTTP/1.0
Host: example.com
Save-Data: on
Response:
HTTP/1.0 200 OK
Content-Length: 102832
Vary: Accept-Encoding, Save-Data
Cache-Control: public, max-age=31536000
Content-Type: image/jpeg
[...]
Without
Save-Data
Request:
GET /image.jpg HTTP/1.0
Host: example.com
Response:
HTTP/1.0 200 OK
Content-Length: 481770
Vary: Accept-Encoding, Save-Data
Cache-Control: public, max-age=31536000
Content-Type: image/jpeg
[...]
Specifications
| Specification | Title |
|---|---|
| draft-grigorik-http-client-hints-03, section 7: Save-Data | HTTP Client Hints |
Browser compatibility
Update compatibility data on GitHub
| 49 | ? | ? | ? | 35 | ? | 49 | 49 | ? | ? | 35 | ? | Yes |
Legend
- Full support
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
See also
- Help Your Users `Save-Data` - CSS Tricks
- Delivering Fast and Light Applications with Save-Data - Google Developers
- Network Information API - WICG
- Header to indicate that the content served varies by
Save-Data:Vary
