Once the initial webpage has finished loading, the above script will begin downloading and executing example.js.
Alternatively, the defer attribute also allows for JS to be downloaded without pausing HTML parsing, however takes a different approach to execution by executing the file only once the parsing is complete.
Both of these methods aim to minimize render blocking JS, however in both cases the JS does not wait for the HTML to finish parsing before starting to download or execute (in the case of async).
<script>tags to the bottom of your page. This method however is sub-optimal as the browser will continue to show a busy indicator until the last JS has completely finished being parsed. In some cases, users may not interact with a page until the busy indicator shows that the page is completely loaded, therefore resulting in longer load times and a substandard user experience.
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync