4

Possible Duplicate:
Javascript: Cancel/Stop Image Requests

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)
1

2 Answers 2

1

In Firefox, setting the src of the image to the empty string will abort any active request.

0

Once the browser sent the request for the image it's done, you can't "cancel" it.

Most you can do is hide the image element in such case or show friendly message.

Not the answer you're looking for? Browse other questions tagged or ask your own question.