--- title: EventSource.onopen slug: Web/API/EventSource/onopen translation_of: Web/API/EventSource/onopen ---
La propiedad onopen
de la interfaz {{domxref("EventSource")}} es un {{event("Event_handlers", "event handler")}} llamado cuando un evento {{event("open")}} es recibido, esto pasa cuando la conexión fue solo abierta.
eventSource.onopen = function
evtSource.onopen = function() { console.log("Connection to server opened."); };
Nota: Tu puedes encontrar un ejemplo completo en GitHub — ve Simple SSE demo using PHP.
Especificación | Estado | Comentario |
---|---|---|
{{SpecName('HTML WHATWG', "comms.html#handler-eventsource-onopen", "onopen")}} | {{Spec2('HTML WHATWG')}} | Initial definition |
Caracteristica | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
EventSource support | 6 | {{CompatNo}} | {{CompatGeckoDesktop("6.0")}} | {{CompatNo}} | {{CompatVersionUnknown}} | 5 |
Available in shared and dedicated workers[1] | {{CompatVersionUnknown}} | {{CompatNo}} | {{CompatGeckoDesktop("53.0")}} | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
|
Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | |
---|---|---|---|---|---|---|
EventSource support | 4.4 | 45 | {{CompatNo}} | 12 | 4.1 | |
Available in shared and dedicated workers[1] | {{CompatVersionUnknown}} | {{CompatGeckoMobile("53.0")}} | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
[1] But not service workers as yet.