Script Placement
Scripts in <head> without defer/async block rendering. Scripts at the end of <body> run after the page is visible.
Modern best practice: put scripts in <head> with defer for clean HTML structure.
Scripts in <head> without defer/async block rendering. Scripts at the end of <body> run after the page is visible.
Modern best practice: put scripts in <head> with defer for clean HTML structure.
<!-- Old approach: scripts at end of body -->
<body>
<p>Content here</p>
<script src="app.js"></script>
</body>
<!-- Modern approach: defer in head -->
<head>
<script src="app.js" defer></script>
</head>
Use defer in <head> — it gives the same benefit as end-of-body placement with cleaner structure.