Image completeProperty
Image Object
Definition and Usage
The complete property returns whether the browser has finished loading the image.
It returns true if loading is complete, otherwise false.
Syntax
imageObject.complete
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the complete property.
Example
Example
The following example detects whether the image has finished loading:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function alertComplete(){
alert("Image loaded: " + document.getElementById("compman").complete);
}
</script>
</head>
<body onload="alertComplete()">
<img id="compman" src="compman.gif.html" alt="Computerman" width="107" height="98">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function alertComplete(){
alert("Image loaded: " + document.getElementById("compman").complete);
}
</script>
</head>
<body onload="alertComplete()">
<img id="compman" src="compman.gif.html" alt="Computerman" width="107" height="98">
</body>
</html>
Try it Yourself »
Image Object Other Extensions