5

我用谷歌页面速度检查了我的网站。

它说指定我的资源的到期时间。

谁能告诉我如何为博主利用浏览器缓存?

4

2 回答 2

4

You cannot set custom expiration for resources served by Blogger - that part is already done for you by Google servers. Having said that, if you serve content from any third party domains (which you are), then you should look into enabling compression and caching on those hosts.

Of course, sometimes this will be out of your control - ex, third party widgets which you do not control directly.

于 2012-08-25T18:45:00.450 回答
1

您必须在托管设置中设置 expires 标头。如果您在Google App Engine(免费)上托管了您的网站,您可以将 expires 标头设置webapp-web.xml为 10 天。

<include path="/assets/**.css" expiration="10d" /> 
<include path="/assets/**.js" expiration="10d" /> 

我浏览了你的网站,看到你使用博客来写文章,你不能为博客图片和帖子设置过期标题。

我已经使用Google's 基础设施来托管我的图像CSSJS文件。但是,如果您想在自定义 JS 文件和 CSS 文件上即兴发挥您的 pagespeed 分数,我的博文可以帮助您在 Google 中托管静态内容。我的博客页面速度得分约为 94。

免责声明:我已经撰写了链接中提到的帖子。

如果您将 CSS 和 JS 文件托管在其他托管位置,您应该寻求帮助来设置expires header,以防您使用ApacheWeb 服务器进行托管。

于 2012-08-28T05:33:49.287 回答