- The browser reads each script tag in the order in which it appears in the document.
- There is no limit to the number of script tags in a document.
- The same-origin policy prevents scripts hosted at other domains from running unless CORS has been setup.
NOTE: For older code:
CDATAis needed for XHTML pages if the script has any HTML characters like
<script>//<![CDATA[ ...code... //]]></script>
- Do not use the
<!-- //-->hack with scripts. It was intended to prevent scripts from showing up as text on the first generation browsers Netscape 1 and Mosaic.
<script name="my_script" src="path/or/url/to/my_script.js"></script>
nameattribute is optional and is intended for humans only.
<script> document.write('\x3Cscript' + 'src="my_other_script.js">\x3C/script>'); </script>