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 XMLHttpRequestEventTarget.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

BCD tables only load in the browser

See also