For optimal speed, the script "***.js" should be loaded immediately before the closing body tag


(Graham Jackson) #1

I think this is one for @willwood. I have Henk’s great HV-TABS theme, and having installed SEO Rx, the score rating has been dropped by virtue of 6 javascript files being elsewhere that after the end body tag. 3 of these javascript files are part of the HV-TABS theme.

Is this so called ‘error’ something I should just live with or is there something to be concerned about?

Thanks


(Rob Beattie) #2

I think you’ll find that plenty of themes kick up this ‘error’ in SEO-Rx and lower your score as a result, but I’d be really interested to hear what an established dev like Will has to say.


(Graham Jackson) #3

Absolutely - thanks @robbeattie , I had a feeling that other themes did this as well.


(Will Woodgate) #4

Nothing to be concerned about if the page looks and works okay for you in the browser.

Strictly speaking, then yes; it is best to have all Javascript calls towards the end of the page. Most Javascript functions ‘fire’ on page load or window load. So there’s little point having them pollute the DOM higher up the order.

But many themes were developed before page performance became a talking point. Some of the Javascript needs to load early-on, to fix problems in older web browsers, like IE6 - IE10. Or provide attractive page loading effects.

In the fullness of time I might update some of Henk’s themes to try and improve page loading. I would like to ditch support for older browsers and try to re-order things if possible. This might mean simplifying some aspects of the themes to rely more on HTML / CSS effects.

I think most of these existing scripts are very small. So in the grand scheme of things, we’re probably talking about them slowing down a page by hundredths or thousandths of a second. The equivalent time gap of cars across the line in Formula 1 qualifying. So nothing really that the naked eye can see, but testing tools can still flag.


(Graham Jackson) #5

I had a feeling that might be th case Will, but I just thought I’d ask. Thanks for the reply :slight_smile: