Chrome对网页性能的检测--2015-05-05总结

本文介绍了如何使用Chrome浏览器的检测工具分析网页性能,并提出了针对合并JS文件、启用gzip压缩、利用浏览器缓存等优化建议,以提高网页加载速度和用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Chrome浏览器非常强大,使用Chrome浏览器对页面性能进行检测,根据测试的结果进行优化。当然这个结果只是参考,在实际的项目中肯定有特殊情况存在,并不能为了满足某项测试结果而忽略特定情况的存在。

1、Chrome检测工具

F12之后点击Audits然后出现了如下界面,选中重载页面开始检测按钮,然后点击Run按钮,之后就是等待结果。


2、检测结果

这个检测结果分为2类,一个是网络,一个是网页性能;

检测结果不仅列出了问题,还定位问题在哪里,可以很快入手解决对应的问题。
问题一:总共有29个可以压缩的JS文件

  1. 合并JS文件:Combine external JavaScript
  2. There are multiple resources served from same domain. Consider combining them into as few files as possible.一个域名有多个文件,可以考虑将他们压缩为尽可能少的文件。

  3. 启用gzip压缩:Enable gzip compression
  4. Compressing the following resources with gzip could reduce their transfer size by about two thirds (~715 B).启用gzip压缩降低传输大小。

  5. 浏览器缓存:Leverage browser caching 
  6. The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers。资源没有指定过期时间,浏览器可能不会缓存。

  7. 代理缓存:Leverage proxy caching (38) ?
  8. Resources with a "?" in the URL are not cached by most proxy caching servers:

  9. Minimize cookie size
  10. The average cookie size for all requests on this page is 36 B

  11. Serve static content from a cookieless domain (35)
  12. 12.8 KB of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:

  13. Specify image dimensions (10)
  14. A width and height should be specified for all images in order to speed up page display. The following image(s) are missing a width and/or height:

网页性能部分
  1. 1、优化样式和脚本的顺序:Optimize the order of styles and scripts (4)
    1. The following external CSS files were included after an external JavaScript file in the document head. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript.

  1. 2、把CSS放到head中:Put CSS in the document head (3)
  2. CSS in the document body adversely impacts rendering performance.
  3. 3、删除没用的CSS:Remove unused CSS rules (44)
    1. 44 rules (19%) of CSS not used by the current page.
  4、Use normal CSS property names instead of vendor-prefixed ones (3)





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值