I have used it for the upcoming version of Panoramio, where I only show the images after they have been fully loaded.
There is however a subtle difference between Internet Explorer and Firefox related to this event.
If you set up the handler to this event after setting the
src of the image and the image is in the cache, Internet Explorer will not fire the onload event.Internet Explorer fires this event inmediatelly if the image is in the cache, so you should do:
img.onload = onLoadHandler;
img.src = "foo.png";
instead of
img.src = "foo.png";
img.onload = onLoadHandler;
or your code will not work on Internet Explorer for cached images.
This totally saved me. Thank you.
ReplyDeleteThanks! Great post!
ReplyDeleteI have been tearing my hair out for two nights because of this bug. Thankyou SO much. Check out what I've been working on here: http://puremango.co.uk/mask/
ReplyDeleteI've given you credit in the code. thanks again.
Thank you!
ReplyDeleteExcellent decision? it very helps me!
How to put the progress bar while loading markers in the google map?
ReplyDeletethx
Almost good enough...
ReplyDeleteWhat if I cant set the handler before setting the src?
Is there a property like 'isLoaded' or something to figure out if the image has already loaded?
I have been tearing my hair out for two nights because of this bug. Thankyou SO much. Check out what I’ve been bez torba working on here:
ReplyDelete