What Sequence should be for execution of javascript / jquery / CSS and other controls for HTML page rendering? [closed]

StackOverflow https://stackoverflow.com/questions/15760865

Question

What should be best practices to fast loading of webpage. What are the important things for consideration?

Was it helpful?

Solution

1) Compress/Minify CSS and JS Files:Compression reduces response times by reducing the size of the HTTP response.

2) Put CSS at top: Moving style sheets to the document HEAD element helps pages appear to load quicker since this allows pages to render progressively.

3)Put Javascript at bottom: JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. To help the page load faster, move scripts to the bottom of the page if they are deferrable.

4) Reduce the number of DOM elements: A complex page means more bytes to download, and it also means slower DOM access in JavaScript. Reduce the number of DOM elements on the page to improve performance.

5) Make fewer HTTP requests: Decreasing the number of components on a page reduces the number of HTTP requests required to render the page, resulting in faster page loads. Some ways to reduce the number of components include: combine files, combine multiple scripts into one script, combine multiple CSS files into one style sheet, and use CSS Sprites and image maps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top