-
Book Overview & Buying
-
Table Of Contents
ASP.NET Site Performance Secrets
By :
JavaScript files are static files, just as images and CSS files. However, unlike images, when a JavaScript file is loaded or executed using a<script> tag, rendering of the page is suspended.
This makes sense, because the page may contain script blocks after the<script> tag that are dependent on the JavaScript file. If loading of a JavaScript file didn't block page rendering, the other blocks could be executed before the file had loaded, leading to JavaScript errors.
You can confirm that loading a JavaScript file blocks rendering of the page by running the website in the folder JavaScriptBlocksRendering in the downloaded code bundle. This site consists of a single page that loads a single script, script1.js. It also has a single image, chemistry.png, and a stylesheet style1.css. It uses an HTTP module that suspends the working thread for five seconds when a JavaScript file is loaded. Images and CSS files...
Change the font size
Change margin width
Change background colour