HTTP headers | If-Modified-Since

The If-Modified-Since header is a request-header that is sent to a server as a conditional request. If the contents have changed, the server responds with a 200 status code and the entire requested document is updated. The If-Modified-Since HTTP header indicates the time for which a browser first downloaded a resource from the server. This helps to determine whether the resource has changed or not, since the last time it was accessed. If the status of a particular resource is 304 Not Modified, this means that the file has not changed and there is no need to download it again.

Let us take an example of this website i.e. GeeksforGeeks, it has different pages about computer science subjects. Whenever a search engine visits this website, it will check each page of the website and if none of the pages have changed, it will not load any of those pages. But if there is a change in any one of its pages, a flag will raise. So when the search engine visits, it will see the flag for the changed page, and then it will access that page.

Note: When used in combination with the If-None-Match, it is ignored, unless the server does not support If-None-Match.

Syntax:

If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT



Directives: This header accept eight directive as mentioned above and described below:

  • <day name>: It contains the day’s name like “Mon”, “Tue” etc.(case-sensitive).
  • <day>: It contains the date in 2 digit numbers, like “04” or “23” for days.
  • <month>: It contains the name of the month, in 3 letter month names like “Jan”, “Feb” etc.(case-sensitive).
  • <year>: It contains the 4 digit year like “2020”
  • <hour>: It contains the hour in 2 digit hour like “07” or “12”.
  • <minute>: Same as hour minutes 2 digit minute like “09” or “55”
  • <second>: Containing the seconds in 2 digits second like “08” or “50”.
  • GMT: All the dates in HTTP will show in Greenwich Mean Time format, not in local time format.

Example:

If-Modified-Since: Sun, 10 May 2020 02:01:00 GMT 

Supported Browsers: The browsers supported by HTTP header If-Modified-Since header are listed below:

  • Google Chrome
  • Firefox
  • Internet Explorer
  • Opera
  • Safari
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.