Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
40
rated 0 times [  41] [ 1]  / answers: 1 / hits: 20234  / 12 Years ago, wed, july 18, 2012, 12:00:00

Possible Duplicate:

Where is the best place to put <script> tags in HTML markup?






Where should I put my external JavaScript file? I know that people put it at the end of the body tag to make the web page look like it loads faster. But is there any cons about putting it at the end?



And would this be a good practice to put the JavaScript with the Google Analytics code?



<body>
// Everything else over here ... conent etc..
<script src=myjavascript.js type=text/javascript></script>
<script type=text/javascript>
// google analytics code
</script>
</body>

More From » html

 Answers
6

Yes people usually put it at the end for faster page loads. What you have there with the google analytics script is common practice.



You might also want to check out head.js - this has been shown to be even faster than a single script put at the end of the body


[#84168] Tuesday, July 17, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
austonjuancarlosb

Total Points: 238
Total Questions: 89
Total Answers: 99

Location: Chad
Member since Mon, Dec 5, 2022
1 Year ago
;