1. Home
  2. Computing & Technology
  3. JavaScript
photo of Stephen Chapman

Stephen's JavaScript Blog

By Stephen Chapman, About.com Guide to JavaScript since 2004

Failsafe Remote Images

Saturday June 28, 2008
Not all browsers provide the same means for JavaScript to tell if an image has loaded

If your site uses images remotely loaded from another site to display advertising (or for any other reason) then what gets displayed when that other site is down? This script determines if the images on the page have loaded correctly and if not then an image from your site is substituted.There are simpler methods available in JavaScript for doing this but one or more versions of the major browsers doesn't support each of those methods properly. This is the simplest JavaScript solution that works for all browsers.

Failsafe Remote Images

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore JavaScript

More from About.com

  1. Home
  2. Computing & Technology
  3. JavaScript

©2008 About.com, a part of The New York Times Company.

All rights reserved.