Hello everyone,
How wrong is it to place the script tag after the closing tag of the body (</body>
). ?
<html>
....
<body>
....
</body>
<script type="text/javascript" src="theJs.js"></script>
</html>
Thanks
Hello everyone,
How wrong is it to place the script tag after the closing tag of the body (</body>
). ?
<html>
....
<body>
....
</body>
<script type="text/javascript" src="theJs.js"></script>
</html>
Thanks
It won't validate outside of the <body>
or <head>
tags. It also won't make much difference -- unless you're doing DOM manipulations that could break IE before the body element is fully loaded -- to putting it just before the closing </body>
.
<html>
....
<body>
....
<script type="text/javascript" src="theJs.js"></script>
</body>
</html>
Yes. Only comments and the end tag for the html element are allowed after the end tag for the body.
Browsers may perform error recovery, but you should never depend on that.
Yes. But if you do add the code outside it most likely will not be the end of the world since most browsers will fix it, but it is still a bad practice to get into.