Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.

The BroadcastChannel interface represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel.

Note : Cette fonctionnalité est disponible via les Web Workers.

Constructor

BroadcastChannel()
Creates an object linking to the named channel.

Properties

This interface also inherits properties from its parent, EventTarget.

BroadcastChannel.name
Returns a DOMString, the name of the channel.

Event handlers

BroadcastChannel.onmessage
An EventHandler property that specifies the function to execute when a message event is fired on this object.
BroadcastChannel.onmessageerror
An EventHandler called when a MessageEvent of type MessageError is fired—that is, when it receives a message that cannot be deserialized.

Methods

This interface also inherits methods from its parent, EventTarget.

BroadcastChannel.postMessage()
Sends the message, of any type of object, to each BroadcastChannel object listening to the same channel.
BroadcastChannel.close()
Closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected.

Events

message
Fired when when a message arrives on the channel.
Also available via the onmessage property.
messageerror
Fired when a message arrives that can't be deserialized.
Also available via the onmessageerror property.

Specifications

Specification Status Comment
HTML Living Standard
La définition de 'BroadcastChannel' dans cette spécification.
Standard évolutif Initial definition.

Browser compatibility

Update compatibility data on GitHub
OrdinateurMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebview AndroidChrome pour AndroidEdge MobileFirefox pour AndroidOpera pour AndroidSafari sur iOSSamsung Internet
BroadcastChannelChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
BroadcastChannel() constructorChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
message eventChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
messageerror eventChrome Support complet 60Edge ? Firefox Support complet 57IE Aucun support NonOpera Support complet 47Safari Aucun support NonWebView Android Support complet 60Chrome Android Support complet 60Edge Mobile ? Firefox Android ? Opera Android Support complet 47Safari iOS Aucun support NonSamsung Internet Android Aucun support Non
nameChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
onmessageChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
onmessageerrorChrome Support complet 60Edge ? Firefox Support complet 57IE Aucun support NonOpera Support complet 47Safari Aucun support NonWebView Android Support complet 60Chrome Android Support complet 60Edge Mobile ? Firefox Android ? Opera Android Support complet 44Safari iOS Aucun support NonSamsung Internet Android Aucun support Non
closeChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0
postMessageChrome Support complet 54Edge ? Firefox Support complet 38IE Aucun support NonOpera Support complet 41Safari Aucun support NonWebView Android Support complet 54Chrome Android Support complet 54Edge Mobile ? Firefox Android ? Opera Android Support complet 41Safari iOS Aucun support NonSamsung Internet Android Support complet 6.0

Légende

Support complet  
Support complet
Aucun support  
Aucun support
Compatibilité inconnue  
Compatibilité inconnue

See also

Étiquettes et contributeurs liés au document

Contributeurs à cette page : wbamberg
Dernière mise à jour par : wbamberg,