How to show something when an image displays?
I want开发者_JS百科 to check if an application is running on another server and the only way I can do this is by displaying an image that it provides.
If it doesn't provide the image, I use the alt attribute to inform that the app is down. I cannot modify what's in the image, so I need a way to show something else that says that the app is up instead of saying "if you see this image it means that the app is up".I'd like a CSS/HTML solution, if not, a JS or PHP one.
I'm thinking of hiding the image itself with the "the app is up" message but I don't know how. It doesn't work like image replacement usually do.
You can choose a custom message to display when the image is down using pure HTML and CSS, but for the image loading successfully, I think you're out of luck. Use a JavaScript Ajax request and check the returned status header, and you won't even have to create an image.
精彩评论