El método XMLHttpRequest.abort() aborta la petición si ha sido enviada. Cuando una petición se aborta, readyState se asigna a 0 (UNSENT), pero el evento readystatechange no se lanza.
Sintaxis
xhrInstance.abort();
Parámetros
Ninguno.
Valor de retorno
Vacío.
Ejemplo
var xhr = new XMLHttpRequest(),
method = "GET",
url = "https://developer.mozilla.org/";
xhr.open(method,url,true);
xhr.send();
xhr.abort();
Especificaciones
Especificación | Estado | Comentario |
---|---|---|
XMLHttpRequest | Living Standard | WHATWG living standard |
Compatibilidad con navegadores
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Mejora | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Soporte básico | 1 | ? | 5[1] 7 |
(Yes) | 1.2 |
Mejora | Android | Chrome para Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | ? | 1.0 | (Yes) | ? | ? | ? |
[1] This feature was implemented via ActiveXObject(). Internet Explorer implementa el estándar XMLHttpRequest desde la versión 7.