EventSource.onerror

The onerror property of the EventSource interface is an EventHandler called when an error occurs and the error event is dispatched on an EventSource object.

Syntax

eventSource.onerror = function

Examples

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

Note: You can find a full example on GitHub — see Simple SSE demo using PHP.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'onerror' in that specification.
Living Standard Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
onerrorChrome Full support 6Edge Full support 79Firefox Full support 6IE No support NoOpera Full support YesSafari Full support 5WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 45Opera Android Full support 12Safari iOS Full support 5Samsung Internet Android Full support 1.0

Legend

Full support
Full support
No support
No support

See also