placement of <script

Post here if your topic is about CSS HTML Validator but doesn't fit in another forum.
Post Reply
User avatar
roedygr
Rank V - Professional
Rank V - Professional
Posts: 372
Joined: Fri Feb 17, 2006 5:22 am
Location: Victoria BC Canada
Contact:

placement of <script

Post by roedygr » Tue Apr 15, 2014 2:30 pm

W3C says "The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document."

Do have any thoughts on which is preferable?

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3329
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: placement of <script

Post by Albert Wiersch » Tue Apr 15, 2014 3:27 pm

I think that may depend on what the scripts does, but in general it's probably best to place them right before the end "body" tag if you can, for performance reasons.

Here some more info:
http://stackoverflow.com/questions/4364 ... tml-markup
http://webdesign.about.com/od/speed/a/s ... -speed.htm
Image
Albert Wiersch

Post Reply