Suppose you have a thumbnail generator script that accepts source images in the form of a URL. Is there a way to detect if the source URL is \"broken\" - whether nonexistent
onerror Event
Execute a JavaScript if an error occurs when loading an image:
The onerror event is triggered if an error occurs while loading an external file (e.g. a document or an image).
Example:
A function is triggered if an error occurs when loading the image. The function shows an alert box with a text.
In this example we refer to an image that does not exist, therefore the onerror event occurs.