<script type="text/javascript">function appReady() { // do something}</script><script defer src="/js/app.b5799d78449381e12b5d.js" onload="appReady()"></script>
When you use PageSpeed Insights, it shall complaint of Remove render-blocking JavaScript.
One of the way to solve this is using defer/async loading of JavaScript
.
Defer vs Async
Refer to Script Tag - async & defer.
Defer
- Guarantee order of exectution
- Execute after HTML parser is completed
Async
- No guarantee order of execution (suitable for js like
Google Analytics
) - Pause HTML parser to execute when finish downloading