I'm not sure it's possible to cancel the request by itself, but it's still possible to change your src value or delete your img variable which result in a behavior similar to a request cancellation.
Jérémie 2010/12/22 Steve Esson <[email protected]> > On Wed, Dec 22, 2010 at 3:52 AM, Amit Agarwal <[email protected]> wrote: > > Hi, > > > > How to abort an Image request which is still on the fly? > > > > Example: > > > > var img = new Image(); > > var img.src = "http://www.google.co.in/images/nav_logo29.png"; > > window.setTimeout(function(){ > > //Code to abort/cancel image request if it hasn't triggered onload > or > > onerror even after 20 seconds of sending request. > > },20000) > > This works for me: > > var img = new Image(); > img.src = "http://dummyimage.com/2600x2400/000/fff"; > window.setTimeout(function(){ > img.src = "about:blank"; > },1); > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected]<jsmentors%[email protected]> > -- Jeremie ............................. Web : http://jeremie.patonnier.net Twitter : @JeremiePat <http://twitter.com/JeremiePat> -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
