Forum Moderators: open

Message Too Old, No Replies

Query if use image for "detect other server online"

         

Teresa_Teng

3:36 am on Mar 19, 2003 (gmt 0)

10+ Year Member



If use an image on the other server to check online or not, how to avoid the error image (red 'x' inside little white frame) appear on html page while the server disconnected. Has it language like that:

<img src=ftp://server/image.gif>
if error_image
redirect to image.gif (of local html page)
endif

Thanks.

Teresa

korkus2000

4:19 am on Mar 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you using the VBScript with asp or client side ie VBScript? I don't think you can access if an image has loaded with client side scripting.

tedster

6:18 am on Mar 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the reason it's so challenging to do what you want with JavaScript. Every image tag has three eventhandlers that are associated with that image's complete property --

onload is invoked when an image is fully loaded.
onerror is invoked when an image tag refers to a corrupted file
onabort is invoked when the user interrupts the image load.

I believe (but I'm not sure about this) that onerror is also invoked if the image cannot be retrieved for the stated URI.

The complete property is false while the browser is trying to load the image.

However, complete becomes true when any one of the above three event handlers is invoked -- that is, just because image.complete is true doesn't mean there is an image to display, it just means that the browser has finished dealing with that bit of code.

Now there may be a solution for you in that tangle, but my brain seems too feeble right now to sort it out.