简体   繁体   中英

JavaScript tags, performance and W3C

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.

From the documentation :

This element may appear any number of times in the HEAD or BODY of an HTML document.

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.

是的, SCRIPT元素被允许作为BODY元素的元素

 <!ELEMENT BODY OO (%block;|SCRIPT)+ +(INS|DEL) -- document body --> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM