开发者

how do i cache specific files html / css?

how do i cache specific files in html ? i have tried


meta http-equiv="cache-control" content="private" max-age="604800"

but when i click "audit" using google chrome inspect element its giving me

Leverage browser caching (4)
The following resources are missing a cache expiration. Resources that do not specify an expirati开发者_高级运维on 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

how do i cache em ?


Your syntax is invalid.

<meta http-equiv="cache-control" content="max-age=604800;private" />

Mind you this won't work for CSS/JS or anything else that isn't a HTML file. In those cases you need to set real HTTP headers server-side (which is usually done using webserver settings or via dynamic server-side languages like PHP, .Net, Coldfusion, etc...).


The best way of doing this is to server your files through some kind of server side mechanism that attaches the right cache control headers to the http response.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜