前端优化总结新版

前端性能优化之-35黄金定律
网页内容

  1. 减少http请求次数
  2. 减少DNS查询次数
  3. 避免页面跳转
  4. 缓存ajax
  5. 延迟加载
  6. 提前加载
  7. 减少dom元素数量
  8. 根据域名划分内容
  9. 减少iframe数量
  10. 避免404

服务器

  1. 使用cdn
  2. 添加expires或cache-control报文头
  3. gzip压缩传输文件
  4. 配置etags
  5. 尽早flus输出
  6. 使用get ajax请求
  7. 避免空的图片src

cookie

  1. 减少cookie大小
  2. 页面内容使用无cookie域名

css

  1. 将样式表置顶
  2. 避免css表达式
  3. 用link代替@import
  4. 避免使用filters

javascript

  1. 将脚本置底
  2. 使用外部js和css文件
  3. 精简js和css
  4. 去除重复脚本
  5. 减少dom访问
  6. 使用智能事件处理

图片

  1. 优化图像
  2. 优化css sprite
  3. 不要在html中缩放图片
  4. 使用小且可缓存的favicon.ico

移动客户端

  1. 保持单个内容小于25kb
  2. 打包组建建成符合文档

.
减少http请求
80%的相应时间都是在下载网页内容(images,js
,css,falsh等),减少请求次数是缩短响应时间的关键

1.合并css,js 压缩
2.合并图片(精灵图)CSS Sprites
3.Image Maps: 也是将多幅图拼在一起,然后通过坐标来控制显示导航。这里有个经典的例子,选中图片中的某个人就会将你带到不同的链接
https://www.cnblogs.com/lei2007/archive/2013/08/16/3262897.html
https://www.jianshu.com/p/fe32ef31deed
https://www.cnblogs.com/slightFly/p/11881333.html
https://blog.csdn.net/qq_38045106/article/details/84782401
https://www.cnblogs.com/liuqing576598117/p/10303708.html
https://segmentfault.com/a/1190000019404454?utm_source=tag-newest
https://baijiahao.baidu.com/s?id=1635093315169254640&wfr=spider&for=pc
https://blog.csdn.net/weixin_45556713/article/details/101452701
https://www.cnblogs.com/xsilence/p/10916845.html
https://blog.csdn.net/qq_37939251/article/details/100031285
https://www.jianshu.com/p/c85662560161
https://www.jianshu.com/p/57fa1b0aad44
https://www.jianshu.com/p/1896789fc8a8
https://www.jianshu.com/p/41075f1f5297
https://blog.csdn.net/weixin_34261739/article/details/91472725
https://www.cnblogs.com/shy1766IT/p/11080658.html

https://www.cnblogs.com/lyhomepage/p/5867762.html

https://www.cnblogs.com/changlon/p/10165053.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值