PageSpeed审查和优化 [英] PageSpeed review and optimization

查看:71
本文介绍了PageSpeed审查和优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Pagespeed见解分析了我的页面速度,但没有得到建议.谁能帮我实现它.

I analysed my page speed using google pagespeed insight and got below suggestion. Can any one help me how I can implement it.

Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
Leverage browser caching for the following cacheable resources:
http://www.googletagmanager.com/gtm.js?id=GTM-TVSKP6 (16.2 minutes)

推荐答案

您不能(您无法控制Google服务器,因此不能代表它们设置http标头).

You can't (you do not control the Google servers, so you cannot set http headers on their behalf).

此外,您不想. Google已经为gtm脚本设置了缓存控制标头:

Moreover, you do not want to. Google already sets cache control headers for the gtm script:

Cache-Control:专用,最大年龄= 931

Cache-Control:private, max-age=931

私人"是指http响应仅针对单个用户,不应以许多用户(例如代理服务器)可访问的方式进行缓存.最长期限是文档过期之前的最长期限,必须从服务器重新获取.在任何情况下,您都可能不想摆弄这些设置,因为通常您希望对标签容器进行的任何更改都会迅速传播给用户.

"Private" meaning that the http response is intended for a single user and should not cached in a way that makes it accessible to many users (i.e. a proxy server). Max age is the maximum age for the document before it expires and must be re-fetched from the server. You probably do not want to fiddle with those settings in any case, because usually you want any changes you are making to the tag container propagate to your users quickly.

在任何情况下,Google Pagespeed都是一个准则.设置http标头是一种过度优化,对于某些流量较高的网站可能有意义,但是大多数网站还有其他更简单的问题,可以并且应该首先解决.

Google pagespeed is more of a guideline in any case. Setting http headers is that kind of over-optimization that might make sense for certain high-traffic sites, but most sites have other, simpler problems that can and should be addressed first.

这篇关于PageSpeed审查和优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆