Optimize the Order of CSS and Scripts
For viewing all tips see here
Applicable To
All Browsers
How Improves Page Load Time
o By optimizing parallelization of external resource downloads
o By optimizing browser rendering
Prologue
[Detail of the technology / concept being used in the tip if required]
Why
o Java Script can alter the content and layout of web page and hence browser delays rendering any content that follows script tag until the script has been downloaded, parsed and executed.
o Many browsers block the downloading of resources referenced in the document after the script until those scripts are downloaded, parsed and executed.
o If other files are in the process of downloading and JS file is being referenced, then JS file is downloaded in parallel.
How
o Put external java scripts after external style sheets when JS code doesn’t have any dependency on the CSS files
o Put inline scripts after other resources as it prevents blocking of other download. It also enables progressive rendering. In case other resources are external JS files and on which inline script is dependent then it is not possible.
Exceptions
None
Recommendations
None
Comments
Post a Comment