Script Placement Message Question

For technical support and bug reports for all editions of CSS HTML Validator, including htmlval for Linux and Mac.
kennedyrt
Rank II - Novice
Posts: 20
Joined: Fri Nov 09, 2007 9:57 pm
Location: Kent, Washington

Script Placement Message Question

Post by kennedyrt »

A script placed in the <head> section, especially one with the src attribute, generates the message "Avoid placing scripts (especially longer ones) in the head section if possible. Doing this can make the page seem slower to load because the browser must pause to download (if using the "src" attribute) and run the script. Also, DOM content is not loaded yet so it is not available to the script. In most cases it's best to place scripts right before the </body> end tag. This message is displayed only once."

Should this message be issued if the defer attribute, which delays script loading until the page is rendered, is used with the <script> tag?
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Script Placement Message Question

Post by Albert Wiersch »

Hello,

Yes, that makes sense. In the next v17 update that tip message will not be generated if the "defer" attribute is used.

Thank you for bringing this to my attention.

UPDATE: I've made this change. The new v17 config file (if you want to update now and are using v17) can be downloaded here:
https://www.htmlvalidator.com/downloads ... 170cfg.zip
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial