SlideShare a Scribd company logo
1 of 18
内联脚本对页面性能的影响 怿飞 / 圆心
Who's this guy? 怿飞 / 圆心 in Taobao UED ,[object Object]
Front-End Engineer
http://www.planabc.net
blankzheng@gmail.com,[object Object]
案例分析 脚本执行结束,第二张图才开始下载。 页面加载之后,至少5秒页面无任何内容显示。
影响的主要方面 ,[object Object]
阻塞页面的逐步渲染,[object Object]
对 document.write的依赖关系,[object Object]
使用异步回调。
使用 script 的 defer 属性。,[object Object]
此方法适用于:执行时间小于 300毫秒的内联脚本。
无法解决阻塞页面的逐步渲染的问题。,[object Object]
使用异步回调:setTimeout 最简单的异步调用就是使用  setTimeout:
使用异步回调:setTimeout ,[object Object]
在 Internet Explorer 中实现了逐步渲染。
Firefox中依旧阻塞页面的逐步渲染。,[object Object]
使用异步回调:setTimeout 在这两种情况下(IE中0ms和FF中250ms): ,[object Object]

More Related Content

Viewers also liked

Introduction to Intellectual Property
Introduction to Intellectual PropertyIntroduction to Intellectual Property
Introduction to Intellectual PropertyJane Lambert
 
Bibliotheekinstructie 3 aba chemie
Bibliotheekinstructie 3 aba chemieBibliotheekinstructie 3 aba chemie
Bibliotheekinstructie 3 aba chemieRia Schildermans
 
House sales customer_satisfaction_survey
House sales customer_satisfaction_surveyHouse sales customer_satisfaction_survey
House sales customer_satisfaction_surveyjsembiring
 
Rule Imc Records Management & Discovery Offering Q109 V2
Rule Imc Records Management & Discovery Offering Q109 V2Rule Imc Records Management & Discovery Offering Q109 V2
Rule Imc Records Management & Discovery Offering Q109 V2mikelines
 
Paintball 23 03 08
Paintball 23 03 08Paintball 23 03 08
Paintball 23 03 08arabacamp
 
Strategie in Communicatie
Strategie in CommunicatieStrategie in Communicatie
Strategie in CommunicatieTom Theys
 
Michael Harrison: Registrable Rights
Michael Harrison: Registrable RightsMichael Harrison: Registrable Rights
Michael Harrison: Registrable RightsJane Lambert
 
持続可能な教材開発プロジェクトのために教師がWebですべきこと
持続可能な教材開発プロジェクトのために教師がWebですべきこと持続可能な教材開発プロジェクトのために教師がWebですべきこと
持続可能な教材開発プロジェクトのために教師がWebですべきことSunami Hokuto
 
HYPE on presentations
HYPE on presentationsHYPE on presentations
HYPE on presentationsTom Theys
 
Informatie zoeken in de KHLimmediatheek
Informatie zoeken in de KHLimmediatheekInformatie zoeken in de KHLimmediatheek
Informatie zoeken in de KHLimmediatheekRia Schildermans
 
After reading
After readingAfter reading
After readingandy .
 
An Introduction to Intellectual Property for Commercial Lawyers
An Introduction to Intellectual Property for Commercial LawyersAn Introduction to Intellectual Property for Commercial Lawyers
An Introduction to Intellectual Property for Commercial LawyersJane Lambert
 

Viewers also liked (19)

Survey manual
Survey manualSurvey manual
Survey manual
 
What I learn from my Wallpaper!
What I learn from my Wallpaper!What I learn from my Wallpaper!
What I learn from my Wallpaper!
 
10630
1063010630
10630
 
Confidence, Credibility, and Conflict
Confidence, Credibility, and ConflictConfidence, Credibility, and Conflict
Confidence, Credibility, and Conflict
 
Updated Ucf
Updated UcfUpdated Ucf
Updated Ucf
 
Introduction to Intellectual Property
Introduction to Intellectual PropertyIntroduction to Intellectual Property
Introduction to Intellectual Property
 
Bibliotheekinstructie 3 aba chemie
Bibliotheekinstructie 3 aba chemieBibliotheekinstructie 3 aba chemie
Bibliotheekinstructie 3 aba chemie
 
House sales customer_satisfaction_survey
House sales customer_satisfaction_surveyHouse sales customer_satisfaction_survey
House sales customer_satisfaction_survey
 
Radicaliseringsproces
RadicaliseringsprocesRadicaliseringsproces
Radicaliseringsproces
 
Rule Imc Records Management & Discovery Offering Q109 V2
Rule Imc Records Management & Discovery Offering Q109 V2Rule Imc Records Management & Discovery Offering Q109 V2
Rule Imc Records Management & Discovery Offering Q109 V2
 
Paintball 23 03 08
Paintball 23 03 08Paintball 23 03 08
Paintball 23 03 08
 
Strategie in Communicatie
Strategie in CommunicatieStrategie in Communicatie
Strategie in Communicatie
 
Michael Harrison: Registrable Rights
Michael Harrison: Registrable RightsMichael Harrison: Registrable Rights
Michael Harrison: Registrable Rights
 
持続可能な教材開発プロジェクトのために教師がWebですべきこと
持続可能な教材開発プロジェクトのために教師がWebですべきこと持続可能な教材開発プロジェクトのために教師がWebですべきこと
持続可能な教材開発プロジェクトのために教師がWebですべきこと
 
HYPE on presentations
HYPE on presentationsHYPE on presentations
HYPE on presentations
 
Informatie zoeken in de KHLimmediatheek
Informatie zoeken in de KHLimmediatheekInformatie zoeken in de KHLimmediatheek
Informatie zoeken in de KHLimmediatheek
 
Leningrad's Siege
Leningrad's SiegeLeningrad's Siege
Leningrad's Siege
 
After reading
After readingAfter reading
After reading
 
An Introduction to Intellectual Property for Commercial Lawyers
An Introduction to Intellectual Property for Commercial LawyersAn Introduction to Intellectual Property for Commercial Lawyers
An Introduction to Intellectual Property for Commercial Lawyers
 

Similar to Inline Script

从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型Jackson Tian
 
Lazyload实践
Lazyload实践Lazyload实践
Lazyload实践Wu tianhao
 
模块化和组件化Css
模块化和组件化Css模块化和组件化Css
模块化和组件化CssWu tianhao
 
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型裕波 周
 
Dynamic JS Loader
Dynamic JS LoaderDynamic JS Loader
Dynamic JS Loaderfeifeipan
 
广告前端代码优化
广告前端代码优化广告前端代码优化
广告前端代码优化taobao.com
 
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器iflytek
 
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)Cyril Wang
 
第三方广告代码稳定性和性能优化实战
第三方广告代码稳定性和性能优化实战第三方广告代码稳定性和性能优化实战
第三方广告代码稳定性和性能优化实战leneli
 
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)Will Huang
 
Top100summit automan x之框架介绍 王超
Top100summit automan x之框架介绍 王超Top100summit automan x之框架介绍 王超
Top100summit automan x之框架介绍 王超drewz lin
 
前端性能优化和自动化
前端性能优化和自动化前端性能优化和自动化
前端性能优化和自动化kaven yan
 
【项目分享】赶集移动Web App开发总结
【项目分享】赶集移动Web App开发总结 【项目分享】赶集移动Web App开发总结
【项目分享】赶集移动Web App开发总结 yangdj
 
从零开始做首页
从零开始做首页从零开始做首页
从零开始做首页fangdeng
 
OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发leneli
 
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖drewz lin
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡cachowu
 
reflow & repaint
reflow & repaintreflow & repaint
reflow & repaintRandy Jin
 
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山imShining @DevCamp
 

Similar to Inline Script (20)

从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
 
Lazyload实践
Lazyload实践Lazyload实践
Lazyload实践
 
模块化和组件化Css
模块化和组件化Css模块化和组件化Css
模块化和组件化Css
 
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
从无阻塞并行脚本加载(Lab.js)到浏览器消息模型
 
Dynamic JS Loader
Dynamic JS LoaderDynamic JS Loader
Dynamic JS Loader
 
广告前端代码优化
广告前端代码优化广告前端代码优化
广告前端代码优化
 
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器
Web端交互逻辑抽象的实践—运营h5页面和逻辑自动生成利器
 
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
如何利用 www.webpagetest.org 進行網頁效能分析與改進建議 (真實案例)
 
第三方广告代码稳定性和性能优化实战
第三方广告代码稳定性和性能优化实战第三方广告代码稳定性和性能优化实战
第三方广告代码稳定性和性能优化实战
 
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
 
Top100summit automan x之框架介绍 王超
Top100summit automan x之框架介绍 王超Top100summit automan x之框架介绍 王超
Top100summit automan x之框架介绍 王超
 
Windows 8.1 app 研習營三小時
Windows 8.1 app 研習營三小時Windows 8.1 app 研習營三小時
Windows 8.1 app 研習營三小時
 
前端性能优化和自动化
前端性能优化和自动化前端性能优化和自动化
前端性能优化和自动化
 
【项目分享】赶集移动Web App开发总结
【项目分享】赶集移动Web App开发总结 【项目分享】赶集移动Web App开发总结
【项目分享】赶集移动Web App开发总结
 
从零开始做首页
从零开始做首页从零开始做首页
从零开始做首页
 
OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发
 
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖Top100summit 游戏中的自动化测试 - 金山 - 白银祖
Top100summit 游戏中的自动化测试 - 金山 - 白银祖
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡
 
reflow & repaint
reflow & repaintreflow & repaint
reflow & repaint
 
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山
凡客移动应用之Android + HTML5技术运用 | 凡客 汪健飞 徐金山
 

Inline Script