I need to be able to cancel an image load after a set period of time, and it needs to subsequently call the onError action.
What it will do:
Attempt to retrieve the resource. src="https://www.site.com/cgi-bin/pullimg.cgi?user=+encodeURI(document.cookie) , which pulls a user-specific resource. The cookies are stored in a protected folder.
If it can't in 1 second (1000 ms), then execute onError.
onError changes the images src attribute, then reloads the img. (Changes to different uri, like mirror.site.com/err.png)
Also, it can be a javascript function (newImage).
Sorry for not supplying existing code; I can code in multiple langs though.
See Question&Answers more detail:os