HTML defer attribute


The purpose of the HTML defer attribute is to tell the user agent to defer the execution of a script.

Most of the modern browsers don't support this attribute.

Supported elements

HTML defer attribute supports script element.


<script type="script_type" defer >.....</script>

Type of value




Default value

There is no default value of HTML defer attribute.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML defer attribute with script

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML defer attribute with script</title>
<script type="text/javascript" defer>
function w3r (){
document.write("this is an example of defer attribute")

<body onload="w3r()" >
<p>This is an example of HTML defer attribute. </p> 


html defer attribute with script

View this example in a separate browser window

Example of HTML defer attribute with script.

Previous: HTML declare attribute
Next: HTML dir attribute

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.