On Fri, Apr 24, 2009 at 07:08:05PM +0100, David Gerard wrote:
There was a spec in earlier versions of HTML to put a low-res thumbnail up while the full image dribbled through your dialup - <img lowsrc="image-placeholder.gif" src="image.gif"> - but it was so little used (I know of no cases) that I don't know if it's even supported in browsers any more.
I tried it with FireFox 3.0.9 and IE 7.0.6001.18000; neither paid any attention to it. IE 6.0.2800.1106 under Wine also ignored it. Too bad, that would have been nice if it worked.
I don't know that we need fancy AJAX if we know at page rendering time whether the image is available, though. We might be able to get away with a simple script like this: var ImageCache={}; function loadImage(id, url){ var i = document.getElementById(id); if(i){ var img = new Image(); ImageCache[id] = img; img.onload=function(){ i.src = url; ImageCache[id]=null; }; img.src = url; } } And then generate the <img> tag with the placeholder and some id, and call that function onload for it. Of course, if there are a lot of these images on one page then we might run into the browser's concurrent connection limit, which an AJAX solution might be able to overcome.