onload event
September 18th, 2005 by JoaquĆn Cuenca Abela
You can use the onload event on images to know when the browser has finished the download of an image.
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.
5 Responses to “onload event”
Leave a Reply
RSS
Archives
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
Categories
- css (2)
- html (8)
- Interaction Design (6)
- javascript (11)
- miscellaneous (25)
- new features / improvements (63)
- panoramio (49)
- personal (2)
- places (25)
- Uncategorized (5)
This totally saved me. Thank you.
Thanks! Great post!
I 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/
I’ve given you credit in the code. thanks again.
Thank you!
Excellent decision? it very helps me!
How to put the progress bar while loading markers in the google map?
thx