Learn about how to defer parsing of javascript, we have the largest and most updated how to defer parsing of javascript information on alibabacloud.com
Defer and async features are believed to be "familiar and unfamiliar" to many JavaScript developers, with two features that, literally, are well understood, respectively, as "deferred scripts" and "Asynchronous scripts". However, in the case of
The defer and async features are believed to be familiar to many JavaScript Developers & quot; but not familiar with & quot;. Literally, the two features are well understood; the functions of latency scripts & quot; and & quot; asynchronous scripts &
Our commonly used script tag has two attributes related to performance and JS file download and execution: Defer and async.
Description of defer [from https://developer.mozilla.org/en/html/element/script]
This Boolean attribute is set to indicate to
First of all, take a look at these three words:
Without defer or async, the browser will immediately load and execute the specified script, "immediate" means before the document element that is rendered under the script tag, that is,
Javascript has the blocking feature. When a Browser executes Javascript code, it cannot do other things at the same time. When downloading JavaScript, all browsers will block all other activities, such as downloading other resources, content
In the Site page, usually need to introduce external JS resources, but external JS resources may cause DOM blocking, affecting the speed of page loading. By asynchronous or delay the execution of JS, you can refer to the external JS resources
Always write code when the common habit is that all the JS file directly loaded in the document's head tag, in the writing JS file sometimes to get some file objects when the empty object, this is because the document structure has not been loaded,
ArticleDirectory
Async-HTML code
Defer-HTML code
Async & defer-what are their differences?
Which browsers currently support defer and async?
1. No defer or async attributes
2. All are given the defer attribute.
3. partial
Original address: html5′s async Script AttributeOriginal date: September 22, 2010Translation Date: August 22, 2013
(Translator note: Asynchronous loading can be understood as non-blocking concurrency processing.)
(Translator Note: the recommended
(Translator note: Asynchronous loading, can be understood as non-blocking concurrency processing.)(Translator's note: defer is recommended, but tested to find that the defer attribute is not valid for script within the page, there is no timing
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.