- script attributes:
- async [asynchronous]: Download the script, but without prejudice to the page in other operations. Effective external script. Executed before the load event (certain)
- charset: specify the code represents the character set
- defer [the delay]: The script can be delayed until the document is completely parsed and executed after show. Effective external script. Execution (standard) before DOMContentLoaded event
- src: Resource URI
- type: MIME type commonly used text / javascript text / template
Use: page inline, external references. When both are present, only download, execute external references. External references: maintainability, cache, adapt to the future.
Script code is contained in the interior will be explained sequentially from top to bottom. When parsing and downloading files, the page will be suspended.
If you do not async and defer, script code will be downloaded and parsed from top to bottom order.
Due to block the execution when downloading and parsing, so references on the back body, this time to parse the content of the page.
Document Mode
for both document modes: promiscuous mode, Standard mode
mainly affects: CSS, JavaScript
if no document type declaration, default to promiscuous mode.noscript: browser does not support scripting or you have disabled