HTTP headers | Save-Data

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 bothe 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 bothe 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 supoorted by HTTP Save-Data header are listed below: 

  • Google Chrome
  • Microsoft Edge
  • Opera
  • Firefox
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.