I ran into something very similar...turned out to be an order-of-
operations problem...yours could be the same.  Try binding the event
from your script, and make sure you set the load before the src.

The following does not work in IE when the image is in the browser
cache (but it works in FF), because the load event fires immediately
after setting src, before my handler gets attached to the load event:

$("#someimg")
  .attr({ src: "some/url.jpg" })
  .load(function(){ /* whatever */ });

The following works in both FF and IE...it sets the load handler
before the src attribute:

$("#someimg")
  .load(function(){ /* whatever */ })
  .attr({ src: "some/url.jpg" });


On Feb 3, 2:55 pm, RH <[EMAIL PROTECTED]> wrote:
> From the html running inside of a Thickbox iframe I've discovered that
> something is causing the onerror and onload events for my images to
> not get triggered when running in Firefox 2. This issues does NOT
> occur in IE 7.
>
> For example, try putting this into content that is loaded within a
> Thickbox iframe:
> <img src="http://someotherdomain.com/file.gif?rand=xxx"; ID="myid"
> onerror="alert('img onerr');" onload="alert('img onload');">
>
> When the content loads in IE the "img onload" alert is displayed as
> soon as the file.gif is loaded. However in Firefox 2 the onerror and
> onload events never fire at all, as determined by seeing no alerts at
> all. Likewise the JS error log is empty (no warnings or errors). I
> have also verified using debugging tools that the file.gif is being
> retrieved just find with a 200 status.
>
> I also tried with new Image() by setting its .onload and .onerror
> properties that way, and it makes no difference - does not fire in
> Firefox but does fire just fine in IE.
>
> Now if f I run the page that contains this img code in FF 2 directly
> (outside of Thickbox) then it works perfectly. So in some way either
> Thickbox or JQuery is eating/interfering with the events on the image
> load.
>
> Can someone shed some light on what may be causing this, and what
> possible work arounds or code tweaks I can try? I would be extremely
> grateful for any advice. Thank you!

Reply via email to