Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
2019.01.09.script-loading-techniques
<html>
<head>
<title>Loading scripts</title>
<script src="script1.js" defer></script>
<script src="script2.js" async></script>
</head>
<body>
<!-- Inline block 1 -->
<script type="text/javascript">
document.querySelector('#test').innerHTML = 'This is a test from inline block 1';
</script>
<div id="test"></div>
<!-- Inline block 2 -->
<script type="text/javascript">
document.querySelector('#test').innerHTML = 'This is a test from inline block 2';
</script>
</body>
</html>
document.querySelector('#test').innerHTML = 'This is a test from script 1';
document.querySelector('#test').innerHTML = 'This is a test from script 2';
<script [defer|async] src="[js-file]"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.