XMLHttpRequest: timeout event

The timeout event is fired when progression is terminated due to preset time expiring.

Bubbles No
Cancelable No
Interface ProgressEvent
Event handler property ontimeout

Examples

const client = new XMLHttpRequest();
client.open('GET', 'http://www.example.org/example.txt');
client.ontimeout = () => {
    console.error('Timeout!!')
};

client.send();

You could also set up the event handler using the addEventListener() method:

client.addEventListener('timeout', () => {
    console.error("Timeout!!");
});

Specifications

Specification Status Comment
XMLHttpRequest
The definition of 'timeout event' in that specification.
Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
timeout eventChrome Full support YesEdge Full support ≤18Firefox Full support YesIE Full support 10Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support

See also