Methods


abort Method

Cancels the current HTTP request.

Syntax

XMLHttpRequest.abort()

Return Value

No return value.

Remarks

abort was introduced in Windows Internet Explorer 7.

The abort method interrupts an asynchronous operation in progress. (Pass true to the varAsync parameter of open to create an asynchronous request.)

Calling abort resets the object; the onreadystatechange event handler is removed, and readyState is changed to 0 (uninitialized).

Standards Information

This method is defined in The XMLHttpRequest Object (W3C Working Draft) World Wide Web link.

Applies To

XMLHttpRequest

See Also

send
Tags :


Community Content

boris.reitman
How do I abort a request in IE6 ?
If this was introduced in IE7, then what is the solution for IE6 ?

Tags :

george_5154
abort() does not close the server conection!!!
For all other browsers this is not a critical issue, but for IE this is a major problem becuase it limits server conections to 2. When you have this limitation you really want the conection closed and you want it to be closed immediatly, not in a minute, not even in a seccond.

Imagine you have one connection connection doing a long polling and the other is waiting for the server to respond, but the server is too busy and the request is taking too long to complete, so you want to cancel it becuase the user is getting nervous... now what???... seems easy, isn't it? you just abort() the request in progress and just like that you have a free connection again. But this won't solve your problem, why?.. simply becuase abort() does not close the connection with the server, so you have to wait untill one of the following events occurrs: a) one hour passes since the request was made, b) the server responds, or c) the users becomes impatient and closes de browser and shows his/her middle finger to the screen. Which do you think is going to happen first?... make your bets!

And don't even think to send a third request to the server, becauses that freezes IE for ever.

If you have any other browser you just laugh out loud because you don't have silly limitations like this.


Page view tracker