为了表明需要在每个后续请求之前检查保存的缓存的有效性,我们可以在服务器响应中使用
Cache-Control: no-cache
和验证器(ETag
或 Date
+Last-Modified
)。一种跨浏览器的重新验证方式,考虑到 IE<10, would be to extend the no-cache
值到 max-age=0, must-revalidate, no-cache
等较旧的浏览器。但是,与no-cache
不同的是,如果没有服务器响应,must-revalidate
将不允许使用缓存并显示504错误(理想情况下)。
问题:如何创建跨浏览器(IE<10) mandatory cache check with a mandatory download of the new version (without heuristic risks) if the server is up, and if not, issue the cache?
附注当然,这使得缓存在我们声称要求它完全最新的情况下可能会过时,并且以额外的 HTTP 请求为代价来做到这一点。然而,通过一些有意识的风险方法,显示缓存可能是比显示错误更好的 SEO 策略。