|
|
Q981 Is there any way to test the presence of an image before attempting to display the image?
irt.org | Knowledge Base | JavaScript | Image | Q981 [ previous next ] Q981 Is there any way to test the presence of an image before attempting to display the image?You can detect if the image request failed using the images onError event handler supported by browsers that support the Image object:
You can even check for the image before displaying it so that it works the other way around:
It is also possible to do this without even displaying the image:
Feedback on 'Q981 Is there any way to test the presence of an image before attempting to display the image?' |
-- div -->
|