Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS193H: High Performance Web Sites Lecture 20: Vol 2 – Don't Scatter Inline Scripts Steve Souders Google

Similar presentations


Presentation on theme: "CS193H: High Performance Web Sites Lecture 20: Vol 2 – Don't Scatter Inline Scripts Steve Souders Google"— Presentation transcript:

1 CS193H: High Performance Web Sites Lecture 20: Vol 2 – Don't Scatter Inline Scripts Steve Souders Google

2 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!

3 Load scripts without blocking follow-up from previous lecture: ads Google Analytics degrading script tags pattern – John Resig

4 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"

5 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/

6 Google Analytics "Learn more about where your visitors come from and how they interact with your site." case study: American Cancer Society HTML code:

Ads by Google