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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
timeout eventChrome Full support YesEdge Full support YesFirefox Full support YesIE ? Opera 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
Compatibility unknown  
Compatibility unknown

See also