I'm trying to give the browser the Last-Modified header. However, the browser remembers it only while open. One has only to close and restart the browser, and it no longer returns the If-Modified-Since header. Question: why and how to force the browser to remember Last-Modified after restarting? Probyval Chrome and Mozile.
Sketched a small code to illustrate the problem:
if (isset ($ _ SERVER ['HTTP_IF_MODIFIED_SINCE']) or isset ($ _ ENV ['HTTP_IF_MODIFIED_SINCE'])) { echo 'The server has received an “If-Modified-Since” header from the user with a value of "'. $ _ SERVER ['HTTP_IF_MODIFIED_SINCE']. '" and has confirmed it.'; } else { header ('Last-Modified: Mon, Oct 18 2010 14:15:00 GMT'); echo 'Last-Modified header was sent to user.'; }
That is, if you open a page with this code, and then close the browser, start it again and return to this page, the browser does not return If-Modified-Since.
PS: please do not throw slippers
Для всех кешируемых ресурсов нужно обязательно указывать один заголовок из пары Expires и Cache-Control max-age, а также один заголовок из пары Last-Modified и ETag. Использовать и Expires, и Cache-Control: max-age излишне, как и указывать Last-Modified и ETag одновременно.
Для всех кешируемых ресурсов нужно обязательно указывать один заголовок из пары Expires и Cache-Control max-age, а также один заголовок из пары Last-Modified и ETag. Использовать и Expires, и Cache-Control: max-age излишне, как и указывать Last-Modified и ETag одновременно.
andLast-Modified – "слабый" заголовок, так как браузер применяет эвристические алгоритмы, чтобы определить, запрашивать ли элемент из кеша.
- Visman