Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

close events are generated by several APIs:

HTML DOM
Sent to a target <dialog> to let it know that it has been closed.
IndexedDB API
Sent to the IDBDatabase object representing a database connection when the database is unexpectedly closed. This happens after all transactions have been aborted. You can use IDBDatabase.onclose to establish the event handler.
WebRTC API
Sent to an RTCDataChannel to let it know that a data connection has been terminated. You can use the RTCDataConnection.onclose property to establish an event handler for this, in addition to using addEventListener().
WebSocket API
Sent when a WebSocket connection closes. More information needed here.
Web Workers API
Some browsers used a close event to indicate that a given Worker had shut down; this was at one point part of the specification, but has been removed from the spec, and browsers are in the process of removing support for this event in the Web Workers API.

General info

Specification
HTML Living Standard
The definition of 'close' in that specification.

Indexed Database API
The definition of 'close' in that specification.

WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'close' in that specification.
Interface
Event
Bubbles
No
Cancelable
No
Target
HTMLDialogElement, IDBDatabase, RTCDataChannel, or WebSocket
Default Action
None

Properties

Being an Event, this event implements only the properties of this interface.

Methods

Being an Event, this event implements only the methods of this interface.

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'close' in that specification.
Candidate Recommendation Definition for the WebRTC API
HTML Living Standard
The definition of 'close' in that specification.
Living Standard Definition regarding the <dialog> element
Indexed Database API 2.0
The definition of 'close' in that specification.
Recommendation Definition of the connection closing algorithm and its use of the close event

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Support for the WebRTC event (Yes) No support (Yes) No support (Yes) ?
Support for the WebSockets event (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Support for the IndexedDB event ? No support 50 (50) ? ? ?
Support for the <dialog> event ? No support ? ? ? ?
Support for the Workers event 4 No support 3.5 (1.9.1) through 50 (50) ? 11.5 4
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Support for the WebRTC event ? ? No support ? No support ? ?
Support for the WebSockets event (Yes) (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Support for the IndexedDB event ? ? No support 50.0 (50) ? ? ?
Support for the <dialog> event ? ? No support ? ? ? ?
Support for the Workers event ? 40 No support 1.0 (1.9.1) through 50.0 (50) ? (Yes) 5.1

Étiquettes et contributeurs liés au document

Contributeurs à cette page : erikadoyle, Sheppy, cvrebert, teoli
Dernière mise à jour par : erikadoyle,