Skip to content Skip to sidebar Skip to footer

Is It Possible To Catch Failed Img Loads When The Server Sends Html Instead Of Image Data?

I have a website that links to different images on other websites. Sometimes these images have been removed or the domains are no longer live, etc. To not show these images and rem

Solution 1:

Your question is very similar to this one:

jQuery/JavaScript to replace broken images

Rather than using jQuery and trying to attach an event, I've found it most reliable to write the <img...> element this way:

<imgsrc="image.png"onerror="this.style.display='none';"/>

Post a Comment for "Is It Possible To Catch Failed Img Loads When The Server Sends Html Instead Of Image Data?"