Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
淘宝本地生活 Mini Head 实践
Search
d2forum
August 03, 2012
140
2
Share
淘宝本地生活 Mini Head 实践
淘宝公用头脚本比较大,而head中的脚本会阻塞页面渲染,通过mini head来有效解决head过重问题
d2forum
August 03, 2012
More Decks by d2forum
See All by d2forum
TMS的PHP特性
d2forum
0
1.6k
Leap Motion体感实战
d2forum
0
1.2k
跨终端产品实践
d2forum
12
1.9k
Touching Future—s01-e01
d2forum
2
910
KissyCake
d2forum
3
790
贡献标准.s01.e02
d2forum
3
1.3k
一淘响应式设计实践
d2forum
10
980
响应式web设计与实现介绍
d2forum
8
820
定制版设计开发vs响应式设计开发
d2forum
0
190
Featured
See All Featured
Practical Orchestrator
shlominoach
191
11k
The Limits of Empathy - UXLibs8
cassininazir
1
280
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The agentic SEO stack - context over prompts
schlessera
0
730
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Chasing Engaging Ingredients in Design
codingconduct
0
160
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
260
Transcript
本地生活 Mini 头实践 —— 元晃
OVERVIEW OVERVIEW head 里的 js 头大的问题 解决问题 部署 && 应用
head 里的 js head • 125KB+ • 45KB+ gzip
头大的问题 头大的问题 • 阻塞 ——head 中的脚本会阻塞页面渲染!
头大的问题 头大的问题 <!doctype html> <html> <head> <title>js 阻塞测试 </title> </head>
<body> 主体 </body> </html> <script src="sleep.php?delay=20"></script> 20s
解决问题 解决问题 • 让 head 轻一点 —— 把 head 中的脚本往页面底部挪
解决问题 解决问题 • 但是……
解决问题 HOW? 解决问题 • 作假
解决问题 • 单击此处编辑母版文本样式 – 第二级 – 第三级 • 第四级 –
第五级
解决问题 存储匿名函数
解决问题 • 单击此处编辑母版文本样式 – 第二级 – 第三级 • 第四级 –
第五级 取出匿名函数并执行
• 一个轻量头解决方案 • 只有 50 行左右 • 改造成本低
量化 • HttpWatch • 注意 -HttpWatch 的 clear cache 功能可能有问
题,请用 IE 自带的工具条设置“总是从服务器 更新” Render Start DOM Load Page Load
部署 • 两部分 -mini_core.js 20 行左右,直接写在 head 中 -mini_exe.js 30
行左右 • Source and test code • 本地生活
The End