Presentation on theme: "CS193H: High Performance Web Sites Lecture 20: Vol 2 – Don't Scatter Inline Scripts Steve Souders Google"— Presentation transcript:
CS193H: High Performance Web Sites Lecture 20: Vol 2 – Don't Scatter Inline Scripts Steve Souders Google
announcements 11/17 – guest lecturer: Robert Johnson (Facebook), "Fast Data at Massive Scale - lessons learned at Facebook" Handouts of Vol 2 chapters 1-4 are available in class and at office hours. Copies are being sent to SCPD students. DO NOT COPY OR DISTRIBUTE THESE HANDOUTS!
Load scripts without blocking follow-up from previous lecture: ads Google Analytics degrading script tags pattern – John Resig
ads and async scripts many ads load external scripts why can't these scripts be loaded using these non-blocking techniques? they use document.write if a script containing document.write is loaded asynchronously, the entire page is erased: (click on "Load Dynamically") an alternative: Opera's "Delayed Script Execution"
Opera: Delayed Script Execution opera:config#Delayed%20Script%20Execution "Primarily for low bandwidth devices, not well-tested on desktop. Ignore script tags until entire document is parsed and rendered, then execute all scripts in order and re-render." renders page without blocking for script when script executes, document.write is performed where the script occurred good model for how SCRIPT DEFER should be implemented on all browsers blog post: script-execution-in-opera/
Google Analytics "Learn more about where your visitors come from and how they interact with your site." case study: American Cancer Society HTML code: