postMessage()

The method used to send data between a page and a worker, or between windows, delivered as a message event on the other side.

In more detail

The data is copied with the structured clone algorithm, unless you list transferable objects to move instead. Service workers also use postMessage to tell pages a new version is ready.

Related terms

Taught in

References