Reputation: 1
Today I was looking for website optimization content and I found an article talking about move JavaScript scripts to the bottom of the HTML page. Is this valid with W3C's recommendations? I learned that all JavaScript must be inside of head tag... Thank you.
Upvotes: 0
Views: 737
Reputation:
It is valid. Script tags can be in both the head and body. Moving the script tags to just prior to the closing body tag will significantly boost rendering time in IE, because scripts block parallel downloads.
Upvotes: 1
Reputation: 655319
Yes, the SCRIPT
element is allowed as child of the BODY
element:
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
Upvotes: 0
Reputation: 28170
From the documentation:
This element may appear any number of times in the HEAD or BODY of an HTML document.
Upvotes: 2