How to get browser to use disk cache
Is there a trick to getting the browser to just use what is on disk. Wit开发者_运维百科h everything I try the browser keeps sending headers to the server and I have to send back 304. Here is what I've tried.
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', OPTIMIZATION_CACHING_HEADER_DURATION + time()).' GMT');
header('Cache-Control: max-age='. OPTIMIZATION_CACHING_HEADER_DURATION. ', public'); // expires is not needed with this
header('Vary: Accept-Encoding'); // so that people don't get zipped file if they can't handle it
header('Content-Length: '.strlen($stylesheet));
header('Content-type: text/css'); // Correct MIME type
I've tried variations of this as well using time() as last-modified, used Expires instead of max-age. I saw
PICNIC - I've learned the hard way that refreshing the page will cause browsers to request the scripts again while using links to navigate will allow it to use disk cache. The headers above work as expected.
精彩评论