MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

EventSource.onerror

这篇翻译不完整。请帮忙从英语翻译这篇文章

 

EventSource 的属性 onerror 是当发生错误且这个错误事件(error )被EventSource触发时调用的一个事件处理函数(EventHandler

语法

eventSource.onerror = function

例子

evtSource.onerror = function() {
  console.log("EventSource failed.");
};

Note: 你可以在Github上查看这个完整例子: Simple SSE demo using PHP.

规范

Specification Status Comment
HTML Living Standard
onerror
Living Standard Initial definition

浏览器兼容性

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
EventSource support 6 未实现 6.0 (6.0) 未实现 (Yes) 5
Available in shared and dedicated workers[1] (Yes) 未实现 53.0 (53.0) 未实现 (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
EventSource support 4.4 45 未实现 12 4.1
Available in shared and dedicated workers[1] (Yes) 53.0 (53.0) 未实现 (Yes) (Yes)

[1] But not service workers as yet.

相关链接

文档标签和贡献者

 此页面的贡献者: Char-Ten
 最后编辑者: Char-Ten,