PageSpeed review and optimization

萝らか妹 提交于 2019-12-09 14:52:01

问题


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)

回答1:


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

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

Cache-Control:private, max-age=931

"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 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.



来源:https://stackoverflow.com/questions/25154763/pagespeed-review-and-optimization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!