I am really new to Joomla, but have extensive experience in codeigniter and other standard web building technologies. Maybe I am confused, but everywhere I look I see people saying to put links to javascript files within the head tag when dealing with joomla. But I was taught that the only javascript file that goes into the head tag is something like the modernizr.js because it has things to do before the DOM even finishes loading. All other javascript files should go just before the closing body tag. Did I miss a paradigm shift in the way we layout a html page?
Asked
Active
Viewed 140 times
0
-
Javascript files don't necessarily have to go before the closing body tag but a lot of people do this to reduce page loading speeds. I'm not too sure exactly what your question is. Are you trying to find out the differences between loading js files in the head and before the closing body tag? – Lodder Mar 20 '14 at 12:38
-
Lodder, I have always added my javascript file calls at the end of a html page. But since I have been dealing with Joomla, I see the status quo is to have them in the head tag. I just wondered if this was something particular to the Joomla community or Joomla itself. I think in my templates, I will just keep them towards the bottom with exception of something like modernizr. – Energetic Pixels Mar 27 '14 at 03:21
1 Answers
0
Well it's a common question and both options are correct, you can read more here:
Should I write script in the body or the head of the html?
Where should I put the CSS and Javascript code in an HTML webpage?