What is the best way to get JS into the page?
It’s been well know that scripts block. In older browser external scripts block next objects from being downloaded and in all browsers both external and inline scripts block DOM parsing and page rendering. Since 2008, per the recommendations of Yahoo! and Steve Souders’ book, the advice has been to combine external scripts and move the script to the bottom of the HTML in order to get optimal page performance. Then came the dynamic loading of scripts: appending a script to the DOM without blocking the UI thread. Script loaders like LABjs and Yepnope emerged, enabling web developers to load multiple script tags in a non-blocking way, while preserving execution order and even with the ability to couple external scripts with inline JS code. And the story continues. There is the defer attribute, the async attribute and async=false is coming soon.
With so many ways to get JS code into the page, how do you, the web developer, decide which technique(s) to use to get optimal performance for your pages? As a starting point, you need a solid understanding of the various techniques and how they behave in the popular browsers under different conditions.My presentation will cover:
I will present results of extensive, recent testing.Takeaways:
Web performance optimization consultant. Founder of www.turbobytes.com. Snowboarder. Dad. Born in the USA, lives in The Netherlands.
Comments on this page are now closed.
For information on exhibition and sponsorship opportunities at the conference, contact Yvonne Romaine at firstname.lastname@example.org
View the listing of Velocity Europe Media Partners. For more information, contact Norbert Weider at norbert.weider@ googlemail.com or Isabel Schmittknecht at Schmittknecht@book-fair.com.
View a list of Velocity Europe contacts