Previously, scripts introduced on the page were directly written in the head label.
<SCRIPT type = "text/JavaScript" Language = "JavaScript" src = "test. js"> </SCRIPT>
I have never added the defer attribute to the script tag.
Today, we can see that someone is using this label. It is quite useful to check it from Baidu,It means loading the introduced JS script after the labels in the page are loaded.,
However, defer also has drawbacks. The script introduced after the <SCRIPT> label cannot write document. Write (), becauseDirectly output the results. Also, the script that is executed immediately cannot be added to defer = "Defer" (but the default defer is false, and the default attribute can be added );
What's even worse isFirefox does not support this Script Attribute. Chrome should support this attribute. However, unlike IE, Chrome does not execute two scripts in chrome. The following scripts borrow the preceding script, the following may be executed first, but it is not loaded yet.
It was very depressing and I was so happy that I finally felt the most stupid way:Place the JS script at the bottom of the page.
If there is any better way to use a single position, please share it. If there is anything wrong with my writing, please point it out. Thank you !!!