1

If my page contains images with urls on other domains. How long does it take that image to fail if the domain does not respond?

Is it browser dependent?

Currently once an image errors out, I replace the URL with a fail image so I know that it failed.

The image is in fact on the other domain, but it seems to take a while to serve it. These images are favicons.

Here it the klass method that handles the repalcement:

init: function () {
    window.addEventListener("error", function (event) {
        if (event.target.tagName === 'IMG') {
            event.target.src = 'arcmarks/images/image_fail_50.png';
            event.preventDefault();
            event.stopPropagation();
        }
    }, true);
},

1 Answers1

1

If I were you I would proxy this through my server and use the header status of the remote HTTP response and return a placeholder for anything != 200.

Could you not use XHR to determine this before adding it to the page?

Kyle Campbell
  • 186
  • 1
  • 4
  • off the top of my head, I would assume that is is more efficient to just send the image from their server to my user's client ( 1 hop ) instead of from their server, to my server, to my client ( 2 hops ). But in general if I was worried about efficiency, I would save all the images in the form of a sprite and just server them in directly from server to client ( 1 hop ) with many less requests. –  Jan 05 '14 at 15:42