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 # event-xhr-timeout |
XMLHttpRequest # handler-xhr-ontimeout |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
timeout event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.