XHR timeout property vs manual abort() for request cancellation in IE10
0 reputation · 23 Apr 2023, 02:30 UTC
Managing Request Lifecycles in Internet Explorer 10
When implementing network request timeouts in IE10, there is a discrepancy between the native XMLHttpRequest.timeout property and the manual invocation of XMLHttpRequest.abort() via a timer.
The native ontimeout event is intended to handle request expiration automatically. However, there is uncertainty regarding its reliability in IE10, where requests may either hang or complete regardless of the timeout value. An alternative approach involves using setTimeout to explicitly call abort(), which triggers the onabort event.
This creates a trade-off between using a built-in API that may be inconsistent and a manual implementation that introduces potential race conditions between the timer and the onreadystatechange callback.
- Does the
timeoutproperty in IE10 reliably trigger theontimeouthandler across different network conditions? - Is manual
abort()the only guaranteed method to terminate an in-flight request in this version?