Skip to content

HHN0609/script-load-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A experiment about script loading

Something about the experiment

When I was preparing for the interview this autumn. I was always asked that

"Do you know the two properties of defer and async on the <script>? What are the functions of these two properties ?"

Of course! There are so many answers on the forum, and it is easy to get the answer. But is it true? And that's why I start this experiment.
In this experiment, I resort to the Performance in Chrome Devtool. Let's begin!

Normal

<body>
    <h1>Script without defer or async</h1>
    <script src="./src/normal.js"></script>
</body>

some screenshots

please config your DNS


please config your DNS


please config your DNS


please config your DNS

picture from forum

please config your DNS

Defer

<body>
    <h1>Script with defer</h1>
    <script defer src="./src/defer.js"></script>
</body>

some screenshots

please config your DNS
Between finishing parsing html and executing javascript code, there isn't layout,paint or composite.


please config your DNS


please config your DNS

picture from forum

please config your DNS

Async

<body>
    <h1>Script with async</h1>
    <script async src="./src/async.js"></script>
</body>

some screenshots

please config your DNS


please config your DNS


please config your DNS

picture from forum

please config your DNS


please config your DNS

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published