Magic electronic kitten 2022-01-26 20:22:23 阅读数:747
C Language class is a mess
External file example.js Will be loaded into the current page .
It means best to use
therefore , The code located in the external domain will also be loaded and parsed .
HTML 4.01 by <script> The label defines defer attribute .
The purpose of this property is to show that the script will not affect the construction of the page when it is executed . in other words , The script will be delayed until the entire page has been parsed before running . therefore , stay <script> Element defer attribute , amount to Tell the browser to download now , But delay execution .
HTML5 The specification requires scripts to be executed in the order in which they appear , So the first delay script will execute before the second delay script , And these two scripts will precede DOMContentLoaded Event to perform . But in reality , Their execution sequence is not necessarily so rigorous , So it's best to include only one delay script .
defer Property only applies to external Script files . Therefore support HTML5 The realization of Ignore to The embedded Script settings defer attribute .
Putting the delay script at the bottom of the page is the best choice .
XHTML In the document , To put defer Property is set to defer="defer".
TML5 by <script> The element defines async attribute .
async The same applies only to external script files , And tell the browser to download the file immediately . But the mark is async Script for There is no guarantee that they will be executed in the order specified . It is important to ensure that scripts do not depend on each other .
Appoint async The purpose of the attribute is Don't let the page wait for two scripts to download and execute , To load the rest of the page asynchronously . So , Asynchronous scripts are recommended Do not modify... During loading DOM.
The asynchronous script will be on the page load Before the event , But it could be in DOMContentLoaded Before or after the event triggers .
The first two document modes are Hybrid mode and The standard model , Later, it was proposed that Quasi standard model , There is almost no difference between standard mode and quasi standard mode . So when someone mentioned “ The standard model ” when , It could be any of them .
* * . *
. ∧＿∧ ∩ * *
* * ( ・∀・)/ .
. ⊂ ノ* *
* * (つ ノ .*
This element can contain information that can appear in the document <body> In addition to <script> Anything outside the element HTML Element . Included in <noscript> The contents of the element will only be displayed if ：
This page will display a message to the user if the script is invalid . In a browser with scripting enabled , Users will never see it .
copyright：author[Magic electronic kitten]，Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201262022195491.html