I just posted a somewhat controversial tutorial on how to enhance page load time by embedding scripts using Global Content Blocks instead of linking to them externally.
http://blog.arvixe.com/using-global-con ... embedding/
I would appreciate feedback about this technique.
Cheers!
Ken
Tutorial: Embedding Javascript using Global Content Blocks Topic is solved
Re: Tutorial: Embedding Javascript using Global Content Bloc
Why is it controversial?
Re: Tutorial: Embedding Javascript using Global Content Bloc
As CMS generally loads the body first, by putting the scripts in the head does this in effect mean they are actually at the bottom?
Not sure if your technique makes any difference to the speed, as, are not external files cached by the browser anyhow.
Another important perhaps more so than you mentioned is to host sites on a decent server with something like eAccelerator installed, makes a lot of difference.
Thanks for the CGExtensions minify technique as I didn't know about that.
Not sure if your technique makes any difference to the speed, as, are not external files cached by the browser anyhow.
Another important perhaps more so than you mentioned is to host sites on a decent server with something like eAccelerator installed, makes a lot of difference.
Thanks for the CGExtensions minify technique as I didn't know about that.
Re: Tutorial: Embedding Javascript using Global Content Bloc
Hi Applejack,
It is true that CMSMS processes the BODY before the HEAD. However, your conclusion that placing Javascript in the HEAD will therefore load last, does not follow from that.
The reason is that there are two big steps in how a web page gets from CMS Made Simple to the Viewer.
1. CMSMS (Server) generates the page. This is where the BODY is processed before the HEAD. This process is 100% completed before the page is sent to the Viewer (step 2).
2. The Viewer's web browser (Client) fetches the page, parses it, and downloads all the linked resources (scripts, media, css, etc), assembles it and displays it to the Viewer.
Most page optimization is concerned with #2 - designing your page in order to minimize the time it takes to download, assemble and display the page to the viewer.
Unlike the Server side, which completely generates the page before serving it, on the Client side most modern web browsers start displaying the page as soon as they have enough information to build the DOM, and then fill in the other pieces (images, scripts, etc) as they are downloaded. This means the browser will start to parse the page, even before the entire HTML file has downloaded.
Browsers always start with the HEAD and then process the BODY.
Hope that answers your question.
It is true that CMSMS processes the BODY before the HEAD. However, your conclusion that placing Javascript in the HEAD will therefore load last, does not follow from that.
The reason is that there are two big steps in how a web page gets from CMS Made Simple to the Viewer.
1. CMSMS (Server) generates the page. This is where the BODY is processed before the HEAD. This process is 100% completed before the page is sent to the Viewer (step 2).
2. The Viewer's web browser (Client) fetches the page, parses it, and downloads all the linked resources (scripts, media, css, etc), assembles it and displays it to the Viewer.
Most page optimization is concerned with #2 - designing your page in order to minimize the time it takes to download, assemble and display the page to the viewer.
Unlike the Server side, which completely generates the page before serving it, on the Client side most modern web browsers start displaying the page as soon as they have enough information to build the DOM, and then fill in the other pieces (images, scripts, etc) as they are downloaded. This means the browser will start to parse the page, even before the entire HTML file has downloaded.
Browsers always start with the HEAD and then process the BODY.
Hope that answers your question.

Re: Tutorial: Embedding Javascript using Global Content Bloc
Thanks that is what I actually thought just wasn't 100% sure.