如何在 html 中缓存特定文件? 我试过了
meta http-equiv="cache-control" content="private" max-age="604800"
但是当我使用谷歌浏览器检查元素点击“审核”时 它给了我
Leverage browser caching (4) The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers: some.css some.js The following resources are explicitly non-cacheable. Consider making them cacheable if possible: some.html some-hosted.html
我如何缓存它们?
最佳答案
您的语法无效。
<meta http-equiv="cache-control" content="max-age=604800;private" />
请注意,这不适用于 CSS/JS 或任何其他非 HTML 文件的文件。在这些情况下,您需要在服务器端设置真正的 HTTP header (通常使用网络服务器设置或通过动态服务器端语言(如 PHP、.Net、Coldfusion 等...))。
关于javascript - 我如何缓存特定文件 html/css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4895337/