The Difference Between ASYNC and DEFER Complete With Explanations

Read too:

The Difference Between ASYNC and DEFER Complete With Explanations
In the world of the web, you must be familiar with the name Async and Defer. Yes, these two names are often used when you want to load something (usually Javascript) created externally.

Async and Defer have the same function, that speeds up web loading. It's just that there are some differences that are not too obvious from both. Well, this is a difference that people rarely know, even some think Async with Defer is the same.

And so much different ...

Therefore, this time I want to explain what are The differences between Async and Defer earlier. Please take a good look ...

Explanations And Differences Between ASYNC and DEFER JavaScript

1. Async

Async, or more completely Asynchronous is an antonym of Sync or Synchronous. Async when translated into Indonesian means asynchronous, aka out of sync.

Async given scripts will be downloaded when the HTML is in the parse, then after the download is complete, the script is executed immediately. When the script is running, HTML will stop parsing. When finished executing, then HTML continue parse until finished.

By using Async, HTML will still load quickly without waiting for the external script download process first. Async has 1 disadvantage, ie for laptop users/devices that are low-end specifications, too many Async scripts will create lag.

In addition, Async can also make some scripts to be non-work, resulting in common problems such as a corrupted drop-down menu.

2. Defer

Defer if translated into the Indonesian language is delaying. In the web world, Defer has a meaning as a delay in execution.

Defer scripts are the same as Async, which is downloaded when HTML is being parsed. The difference is after the download is complete, the script is not directly executed. The new script is executed and executed when the HTML has been completed in parse up to 100%.

Defer has 1 weakness, that could be the script is not running properly because there are some scripts that do have to be executed when the HTML is parsed or not finished parse completely.

So the article about The difference between ASYNC with DEFER Javascript may be useful for you.

Title : The Difference Between ASYNC and DEFER Complete With Explanations

If this article is felt interesting and useful, please share it by pressing the button below :)

Share this

Related Posts

Next Post »

Insert your comment below...