Use defer to load scripts as late as possible
This is a performance boost.
deferto defer the loading of the scripts.
- Don’t use
async="async": it means you are fine with it loading and executing at later time. The smaller scripts will be loaded and executed first.
- You don’t need to use
So your code becomes:
<script src="js/jquery.min.js" defer></script> <script src="js/bootstrap.min.js" defer></script> <script src="js/plugin.js" defer></script> <script src="js/main.js" defer></script>
This should solve your problem.
Set this Boolean attribute to indicate that the browser should,
if possible, execute the script asynchronously. It has no effect on
inline scripts (i.e., scripts that don’t have the src attribute)
This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded. The defer attribute shouldn’t be used on scripts that don’t have the src attribute.