防盗链
减少http 请求
性能黄金法则
1减少组件数量
http连接产生的开销:域名解析--TCP连接--发送请求--等待--下载资源--解析时间
1图片地图<map><area></area></map>
2.css 精灵
background_position
3.合并脚本和样式表适
独立的js比多个js减少时间
4.图片使用base64编码减少页面请求数,base64方式将图片嵌入网页中,而不是从外部嵌入
http缓存机制
缓存分类:
200 from memory cache
304 not modified 数据量小,只发送头信息位
200 ok 没有用到缓存,相对最慢
本地缓存:
相关header
expires 告诉浏览器缓存实现的时刻
pragma
cache-control :no-cache no-store max-age
优先级 pragma>cache-control-expires
last-modify
if-last-modified
etag if-none-match
CDN加速
content delivery network 内容分发网络
本地cache 加速 跨运行商加速 减少远程访问带宽
独立图片服务器