EventSource.onerror
EventSource
的属性 onerror
是当发生错误且这个错误事件(error (en-US)
)被 EventSource 触发时调用的一个事件处理函数(event handler
)
语法
eventSource.onerror = function
例子
evtSource.onerror = function() {
console.log("EventSource failed.");
};
Note: 你可以在 Github 上查看这个完整例子: Simple SSE demo using PHP.
规范
Specification |
---|
HTML Standard # event-error |
HTML Standard # handler-eventsource-onerror |
浏览器兼容性
No compatibility data found for api.EventSource.onerror
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.