timeout
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
当进度由于预定时间到期而终止时,会触发 timeout
事件。
冒泡 | 否 |
可取消 | 否 |
目标对象 | XMLHttpRequest |
接口 | ProgressEvent |
示例
js
var client = new XMLHttpRequest();
client.open("GET", "http://www.example.org/example.txt");
client.ontimeout = function (e) {
console.error("Timeout!!");
};
client.send();
继承
timeout
事件实现了 ProgressEvent
接口,它继承自 Event
— 它拥有在这个接口上定义的属性和方法。
规范
Specification |
---|
XMLHttpRequest Standard # event-xhr-timeout |
XMLHttpRequest Standard # handler-xhr-ontimeout |
浏览器兼容性
BCD tables only load in the browser