All downloaded Internet Explorer 6+ images have appeared. Firefox does not download the image in versions 3-5, but downloads the image from version 6 and higher. As for Chrome, the image will be downloaded at least before version 14. Safari 4 and upload the image.
Run the test yourself: http://jsfiddle.net/jonathansampson/4L9adwcu/
(function () {
var image = document.createElement( "img" ),
timeout = setTimeout(function timeout () {
alert( "Image was not loaded." );
}, 3000);
function loaded () {
clearInterval( timeout );
alert( "Image was loaded." );
}
if ( image.addEventListener ) {
image.addEventListener( "load", loaded );
} else if ( image.attachEvent ) {
image.attachEvent( "onload", loaded );
}
image.style.display = "none";
image.src = "http://gravatar.com/avatar/a84a8714fd33f6676743f9734a824feb";
document.body.appendChild( image );
}());
If I had to think about why this was so, I suspect that it has something to do with loading DOM resources as quickly as possible so that they are ready when they are needed. If the image is not added to the document (this means that we are deleting document.body.appendChild...), it will not be requested.
data-*. , src data-src, :
<img data-src="http://example.com/dont-load-me.png" />
:
imageReference.src = imageReference.getAttribute( "data-src" );
, Internet Explorer.