# How exactly does <script defer=“defer”> work?

JavascriptWeb DevelopmentFront End Technology

The defer attribute is used to specify that the script execution occurs when the page loads. It is used only for external scripts and is a boolean attribute.

## Example

The following code shows how to use the defer attribute:

Live Demo

<!DOCTYPE html>
<html>
<body>
<script src="defer_test.js" defer></script>
</html>