html - 管理 blogspot 的浏览器缓存?

标签 html pagespeed blogspot

我必须提高我的 blogspot 加载速度,但我不知道在哪里管理缓存。在普通网站中,它是 .htaccess 文件。我必须在哪里放置此代码:

 ## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

最佳答案

我认为您可以通过在头部下方部分添加这些元标记来做到这一点

<include expiration='7d' path='/assets/**.css'/> 
<include expiration='7d' path='/assets/**.js'/> 
<include expiration='3d' path='/assets/**.gif'/>
<include expiration='3d' path='/assets/**.jpeg'/>
<include expiration='3d' path='/assets/**.jpg'/>
<include expiration='3d' path='/assets/**.png'/>

检查它是否有效:)

编辑: 我的blog有大量的 JavaScript 和其他繁重的事情在页面启动时运行。 但通过添加此代码和其他一些压缩,我的博客加载速度很快。

关于html - 管理 blogspot 的浏览器缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22051242/

相关文章:

javascript - 使用 paperjs 翻译 Canvas 中的坐标系

javascript - 如何在桌面上使用javascript检测用户在底部

javascript - 如何预加载字体?

html - 我应该在开始时加载隐藏的 iframe 吗?

html - 让 div 覆盖另一个带有 <p> 标签的 div

html - 如何在悬停的 <a> 上放置(有效的)底部边距?

javascript - 压缩和编译 JS 和 CSS

Drupal创建归档 block

javascript - 主页(Blogspot 博客)上的缩略图突然模糊?

button - 如何在BlogSpot帖子中添加文本框和按钮?