Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
120
rated 0 times [  125] [ 5]  / answers: 1 / hits: 67112  / 15 Years ago, wed, october 28, 2009, 12:00:00

I was just using the plugin Yslow for Mozilla Firefox, and it told me that I should put JavaScript at the bottom. I have heard this before but haven't really thought about it too much. Is there really an advantage in putting JavaScript at the bottom of a web page compared to the top?


More From » html

 Answers
7

It'll allow the web page to load visibly before executing JavaScript, which makes sense for things like Google Analytics, which don't need to happen before the page loads.



You may also want to look into things like jQuery, prototype, etc and attach to the ready handler, which executes JavaScript code after the DOM has been fully loaded, which is an appropriate place for much JavaScript code.


[#98431] Friday, October 23, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tobyl

Total Points: 598
Total Questions: 110
Total Answers: 114

Location: Vietnam
Member since Sat, Feb 12, 2022
2 Years ago
tobyl questions
Tue, Aug 10, 21, 00:00, 3 Years ago
Wed, Jan 13, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
;