Open In App

HTTP headers | Save-Data

Last Updated : 29 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The Save-Data is a HTTP request-type header. It is used to indicate whether the client wants to turn on data saving mode or not. Here, data usage is measured in terms of cost and performance. The role of any browser is to provide optimized user experience by providing the highest possible level of performance in a minimal amount of cost. 

  • Save-Data: On 
    It indicates that the user wants to enable data-saving mode. 
     
  • Save-Data: Off 
    It indicates that the user wants to disable data-saving mode.

Browsers supporting this, give the option of switching to and from the data-saving mode. If the data-saving mode is active then the browser is in a position to perform optimization techniques such as text or image compression, which in turn will reduce the amount of data that is to be utilized by the page. 

Syntax: 

Save-Data: <sd-token>

Directives: This header accept a single directive as mentioned above and described below.

  • <sd-token>:  It indicates whether data saving mode is turned on or off.

Example 1: 
With Save-Data:   With save data we will check both the header type Request and Response.

  • Request header:
GET /googlelogo.png HTTP/1.0 
Host: www.google.com
Save-Data: on
  • Response header:
HTTP/1.0 200 OK 
accept-ranges: bytes 
cache-control: private, max-age=31536000 
content-length: 5969 
content-type: image/png 
date: Thu, 14 May 2020 04:18:11 GMT 
expires: Thu, 14 May 2020 04:18:11 GMT 
last-modified: Tue, 22 Oct 2019 18:30:00 GMT 
server: sffe 
status: 200 
x-content-type-options: nosniff 
x-xss-protection: 0

 
Example 2: 
Without Save-data:  Without save data we will check both the header type Request and Response.

  • Request header:
GET /googlelogo.png HTTP/1.0 
Host: www.google.com
  • Response header:
HTTP/1.0 200 OK 
accept-ranges: bytes 
cache-control: private, max-age=31536000 
content-length: 1018
content-type: image/png 
date: Thu, 14 May 2020 04:18:11 GMT 
expires: Thu, 14 May 2020 04:18:11 GMT 
last-modified: Tue, 22 Oct 2019 18:30:00 GMT 
server: sffe 
status: 200 
x-content-type-options: nosniff 
x-xss-protection: 0

Note: The only difference in the output is that when save-data mode is enabled then the content-length is much lower than when the save-data mode is disabled. 

Supported Browsers: The browsers  are supported by HTTP Save-Data header are listed below: 

  • Google Chrome
  • Microsoft Edge
  • Opera
  • Firefox

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads