.load callback for an image does not work in IE 6
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
grigori <grigori.kocha... @gmail.com>
Date: Mon, 19 Jan 2009 09:23:26 -0800 (PST)
Local: Mon, Jan 19 2009 12:23 pm
Subject: .load callback for an image does not work in IE 6
Sample:
<html><head>
<script src="js/jquery-1.3.min.js"></script>
<script>
var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
$(function(){
window.setTimeout(
function mi(){
$('<img>').attr('src',src).appendTo('body').load(function()
{ alert ('Not called in IE 6') });
}
,100
);
})
</script>
</head><body></body></html>
Works in IE7, FireFox, but not in IE 6.
Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
John Resig <jere... @gmail.com>
Date: Mon, 19 Jan 2009 16:20:47 -0500
Local: Mon, Jan 19 2009 4:20 pm
Subject: Re: [jquery-dev] .load callback for an image does not work in IE 6
What happens if you attach the load handler before you insert it into
the document?
--John
On Mon, Jan 19, 2009 at 12:23 PM, grigori <grigori.kocha
... @gmail.com> wrote:
> Sample:
> <html><head>
> <script src="js/jquery-1.3.min.js"></script>
> <script>
> var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> $(function(){
> window.setTimeout(
> function mi(){
> $('<img>').attr('src',src).appendTo('body').load(function()
> { alert ('Not called in IE 6') });
> }
> ,100
> );
> })
> </script>
> </head><body></body></html>
> Works in IE7, FireFox, but not in IE 6.
> Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
malsup <mal... @gmail.com>
Date: Mon, 19 Jan 2009 16:18:19 -0800 (PST)
Local: Mon, Jan 19 2009 7:18 pm
Subject: Re: .load callback for an image does not work in IE 6
> Works in IE7, FireFox, but not in IE 6.
> Is it expectable?
Check the img.complete property. IE won't fire the load event if the
image is retrieved from cache.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
weepy <jonah... @gmail.com>
Date: Mon, 19 Jan 2009 17:05:07 -0800 (PST)
Local: Mon, Jan 19 2009 8:05 pm
Subject: Re: .load callback for an image does not work in IE 6
malsup's right. It's bitten me a few times.
On 20 Jan, 00:18, malsup <mal... @gmail.com> wrote:
> > Works in IE7, FireFox, but not in IE 6.
> > Is it expectable?
> Check the img.complete property. IE won't fire the load event if the
> image is retrieved from cache.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
"steve flitcroft" <jquery.redsqu... @googlemail.com>
Date: Tue, 20 Jan 2009 10:52:20 +0000
Local: Tues, Jan 20 2009 5:52 am
Subject: Re: [jquery-dev] Re: .load callback for an image does not work in IE 6
I though the key was attaching the load event before the src?
On Tue, Jan 20, 2009 at 1:05 AM, weepy <jonah
... @gmail.com> wrote:
> malsup's right. It's bitten me a few times.
> On 20 Jan, 00:18, malsup <mal... @gmail.com> wrote:
> > > Works in IE7, FireFox, but not in IE 6.
> > > Is it expectable?
> > Check the img.complete property. IE won't fire the load event if the
> > image is retrieved from cache.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
redsquare <jquery.redsqu... @googlemail.com>
Date: Tue, 20 Jan 2009 10:55:32 +0000
Local: Tues, Jan 20 2009 5:55 am
Subject: Re: [jquery-dev] Re: .load callback for an image does not work in IE 6
I though the key was attaching the load event before the src?
On Tue, Jan 20, 2009 at 1:05 AM, weepy <jonah
... @gmail.com> wrote:
> malsup's right. It's bitten me a few times.
> On 20 Jan, 00:18, malsup <mal... @gmail.com> wrote:
> > > Works in IE7, FireFox, but not in IE 6.
> > > Is it expectable?
> > Check the img.complete property. IE won't fire the load event if the
> > image is retrieved from cache.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Már <mar.nos... @anomy.net>
Date: Tue, 20 Jan 2009 03:41:39 -0800 (PST)
Local: Tues, Jan 20 2009 6:41 am
Subject: Re: .load callback for an image does not work in IE 6
> I though the key was attaching the load event before the src?
It always seemed that jQuery should perform similar magic when "load"
handlers ar bound to images, as it does for the "document.ready" -
i.e. to trigger the handler if the image is already loaded.
That seems like The jQuery Way to do things - hiding the annoying
technical details away from the user.
--
Már Örlygsson
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
John Resig <jere... @gmail.com>
Date: Tue, 20 Jan 2009 15:39:25 -0500
Local: Tues, Jan 20 2009 3:39 pm
Subject: Re: [jquery-dev] Re: .load callback for an image does not work in IE 6
If you wish, you could file an enhancement bug here and we could check
in to it for a later release.
http://dev.jquery.com/newticket
This sounds like a reasonable addition.
--John
On Tue, Jan 20, 2009 at 6:41 AM, Már <mar.nos
... @anomy.net> wrote:
>> I though the key was attaching the load event before the src?
> It always seemed that jQuery should perform similar magic when "load"
> handlers ar bound to images, as it does for the "document.ready" -
> i.e. to trigger the handler if the image is already loaded.
> That seems like The jQuery Way to do things - hiding the annoying
> technical details away from the user.
> --
> Már Örlygsson
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Már <mar.nos... @anomy.net>
Date: Tue, 20 Jan 2009 15:27:54 -0800 (PST)
Local: Tues, Jan 20 2009 6:27 pm
Subject: Re: .load callback for an image does not work in IE 6
> If you wish, you could file an enhancement bug here and we could check
> in to it for a later release.
Thanks. Here's the ticket:
http://dev.jquery.com/ticket/3930
--
Már Örlygsson
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
"Iraê" <i... @irae.pro.br>
Date: Tue, 20 Jan 2009 22:11:31 -0200
Local: Tues, Jan 20 2009 7:11 pm
Subject: Re: [jquery-dev] Re: .load callback for an image does not work in IE 6
+1 - very useful one
-- irae
On 1/20/09, Már <mar.nos... @anomy.net> wrote:
>> If you wish, you could file an enhancement bug here and we could check
>> in to it for a later release.
> Thanks. Here's the ticket: http://dev.jquery.com/ticket/3930
> --
> Már Örlygsson
--
[]s,
Iraê
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Jomange <jomang... @gmail.com>
Date: Sun, 8 Feb 2009 04:25:48 -0800 (PST)
Local: Sun, Feb 8 2009 7:25 am
Subject: Re: .load callback for an image does not work in IE 6
try this
$(function(){
window.setTimeout(
function mi(){
$('<img>').load(function()
{ alert ('Not called in IE 6') }).attr('src',src).appendTo('body');
}
,100
);
})
it worked for me
On Jan 19, 7:23 pm, grigori <grigori.kocha
... @gmail.com> wrote:
> Sample:
> <html><head>
> <script src="js/jquery-1.3.min.js"></script>
> <script>
> var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> $(function(){
> window.setTimeout(
> function mi(){
> $('<img>').attr('src',src).appendTo('body').load(function()
> { alert ('Not called in IE 6') });
> }
> ,100
> );
> })
> </script>
> </head><body></body></html>
> Works in IE7, FireFox, but not in IE 6.
> Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Jomange <jomang... @gmail.com>
Date: Sun, 8 Feb 2009 04:28:59 -0800 (PST)
Local: Sun, Feb 8 2009 7:28 am
Subject: Re: .load callback for an image does not work in IE 6
try this
$(function(){
window.setTimeout(
function mi(){
$('<img>').load(function()
{ alert ('Not called in IE 6') }).attr('src',src).appendTo('body');
}
,100
);
})
Worked for me
On Jan 19, 7:23 pm, grigori <grigori.kocha
... @gmail.com> wrote:
> Sample:
> <html><head>
> <script src="js/jquery-1.3.min.js"></script>
> <script>
> var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> $(function(){
> window.setTimeout(
> function mi(){
> $('<img>').attr('src',src).appendTo('body').load(function()
> { alert ('Not called in IE 6') });
> }
> ,100
> );
> })
> </script>
> </head><body></body></html>
> Works in IE7, FireFox, but not in IE 6.
> Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Ricardo Tomasi <ricardob... @gmail.com>
Date: Mon, 9 Feb 2009 10:41:23 -0800 (PST)
Local: Mon, Feb 9 2009 1:41 pm
Subject: Re: .load callback for an image does not work in IE 6
What guarantee you have that the image will be loaded in the next
100ms?
The real fix is simple:
$('<img/>').bind('load readystatechange', function(){
if (this.complete)
alert('loaded');
}).attr('src',...).appendTo('body');
On Feb 8, 10:28 am, Jomange <jomang
... @gmail.com> wrote:
> try this
> $(function(){
> window.setTimeout(
> function mi(){
> $('<img>').load(function()
> { alert ('Not called in IE 6') }).attr('src',src).appendTo('body');
> }
> ,100
> );
> })
> Worked for me
> On Jan 19, 7:23 pm, grigori <grigori.kocha
... @gmail.com> wrote:
> > Sample:
> > <html><head>
> > <script src="js/jquery-1.3.min.js"></script>
> > <script>
> > var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> > $(function(){
> > window.setTimeout(
> > function mi(){
> > $('<img>').attr('src',src).appendTo('body').load(function()
> > { alert ('Not called in IE 6') });
> > }
> > ,100
> > );
> > })
> > </script>
> > </head><body></body></html>
> > Works in IE7, FireFox, but not in IE 6.
> > Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Ricardo Tomasi <ricardob... @gmail.com>
Date: Mon, 9 Feb 2009 19:07:49 -0800 (PST)
Local: Mon, Feb 9 2009 10:07 pm
Subject: Re: .load callback for an image does not work in IE 6
Correction:
IE7 is a bit messy. On first load, the .complete property goes from
'false' to 'true' correctly and the load event is not fired. However,
after the image is cached, .complete is always false, readyState is
always == 'complete' and both readystatechange and load fire. I ended
up writing an idea for the patch suggested:
(jQuery.fn.) load : function(fn){
return fn ?
this.is('img') ?
this.bind('load readystatechange', function(e){
if( this.complete || (this.readyState == 'complete' && e.type
== 'readystatechange') )
fn();
})
: this.bind('load', fn)
: this.trigger('load');
}
Is there any other possible way of implementing this? I'm not aware of
all the variables involved.
cheers,
- ricardo
On Feb 9, 4:41 pm, Ricardo Tomasi <ricardob... @gmail.com> wrote:
> What guarantee you have that the image will be loaded in the next
> 100ms?
> The real fix is simple:
> $('<img/>').bind('load readystatechange', function(){
> if (this.complete)
> alert('loaded');
> }).attr('src',...).appendTo('body');
> On Feb 8, 10:28 am, Jomange <jomang... @gmail.com> wrote:
> > try this
> > $(function(){
> > window.setTimeout(
> > function mi(){
> > $('<img>').load(function()
> > { alert ('Not called in IE 6') }).attr('src',src).appendTo('body');
> > }
> > ,100
> > );
> > })
> > Worked for me
> > On Jan 19, 7:23 pm, grigori <grigori.kocha... @gmail.com> wrote:
> > > Sample:
> > > <html><head>
> > > <script src="js/jquery-1.3.min.js"></script>
> > > <script>
> > > var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> > > $(function(){
> > > window.setTimeout(
> > > function mi(){
> > > $('<img>').attr('src',src).appendTo('body').load(function()
> > > { alert ('Not called in IE 6') });
> > > }
> > > ,100
> > > );
> > > })
> > > </script>
> > > </head><body></body></html>
> > > Works in IE7, FireFox, but not in IE 6.
> > > Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Chris Zeh <chris.w.... @gmail.com>
Date: Sun, 15 Feb 2009 21:10:34 -0800 (PST)
Local: Mon, Feb 16 2009 12:10 am
Subject: Re: .load callback for an image does not work in IE 6
Yeah, so I've been banging my head against the wall for multiple hours
because my website in development working perfectly in Safari and
Firefox and works like crap in IE (6 & 7). I finally narrowed the
problem down to IE caching my images, and now this website helped me
realize IE doesn't fire the load event when the image is already
cached.
Thanks for the info! Hopefully a new rev of jQuery can fix this on the
backend.
Regards,
Chris
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Alessandro <ale.v... @gmail.com>
Date: Thu, 19 Feb 2009 06:27:30 -0800 (PST)
Local: Thurs, Feb 19 2009 9:27 am
Subject: Re: .load callback for an image does not work in IE 6
Hi,
i'm pretty new to jquery/javascript, and this bug is affecting my
website...
riccardo, can you please explain your solurion a litle more.. i'm not
getting it.
my code is:
var imageObj = new Image();
$(imageObj).attr("src",imagePath).load(function()
{
//callback function here
});
how shoud I modify that ?
thank you!!!
On Feb 10, 4:07 am, Ricardo Tomasi <ricardob... @gmail.com> wrote:
> Correction:
> IE7 is a bit messy. On first load, the .complete property goes from
> 'false' to 'true' correctly and the load event is not fired. However,
> after the image is cached, .complete is always false, readyState is
> always == 'complete' and both readystatechange and load fire. I ended
> up writing an idea for the patch suggested:
> (jQuery.fn.) load : function(fn){
> return fn ?
> this.is('img') ?
> this.bind('load readystatechange', function(e){
> if( this.complete || (this.readyState == 'complete' && e.type
> == 'readystatechange') )
> fn();
> })
> : this.bind('load', fn)
> : this.trigger('load');
> }
> Is there any other possible way of implementing this? I'm not aware of
> all the variables involved.
> cheers,
> - ricardo
> On Feb 9, 4:41 pm, Ricardo Tomasi <ricardob... @gmail.com> wrote:
> > What guarantee you have that the image will be loaded in the next
> > 100ms?
> > The real fix is simple:
> > $('<img/>').bind('load readystatechange', function(){
> > if (this.complete)
> > alert('loaded');
> > }).attr('src',...).appendTo('body');
> > On Feb 8, 10:28 am, Jomange <jomang... @gmail.com> wrote:
> > > try this
> > > $(function(){
> > > window.setTimeout(
> > > function mi(){
> > > $('<img>').load(function()
> > > { alert ('Not called in IE 6') }).attr('src',src).appendTo('body');
> > > }
> > > ,100
> > > );
> > > })
> > > Worked for me
> > > On Jan 19, 7:23 pm, grigori <grigori.kocha... @gmail.com> wrote:
> > > > Sample:
> > > > <html><head>
> > > > <script src="js/jquery-1.3.min.js"></script>
> > > > <script>
> > > > var src="http://www.google.com/intl/en_com/images/logo_plain.png ";
> > > > $(function(){
> > > > window.setTimeout(
> > > > function mi(){
> > > > $('<img>').attr('src',src).appendTo('body').load(function()
> > > > { alert ('Not called in IE 6') });
> > > > }
> > > > ,100
> > > > );
> > > > })
> > > > </script>
> > > > </head><body></body></html>
> > > > Works in IE7, FireFox, but not in IE 6.
> > > > Is it expectable?
You must
Sign in before you can post messages.
You do not have the permission required to post.