Skip to content

Commit

Permalink
fix: link to Window.postMessage rather than MessagePost.postMessage (m…
Browse files Browse the repository at this point in the history
…dn#37252)

* fix: link to Window.postMessage rather than MessagePost.postMessage

The wrong postMessage method was referenced here. The frame.contentWindow returns a Window, which is a different postMessage and only the Window's postMessage implementation has the correct 3-argument signature as used in the example.

* Update files/en-us/web/api/messagechannel/port2/index.md

---------

Co-authored-by: wbamberg <[email protected]>
  • Loading branch information
activescott and wbamberg authored Dec 18, 2024
1 parent be3f184 commit 5c5b3ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/en-us/web/api/messagechannel/port2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ port attached to the context at the other end of the channel.
In the following code block, you can see a new channel being created using the
{{domxref("MessageChannel.MessageChannel", "MessageChannel()")}} constructor. When the
IFrame has loaded, we pass `port2` to the IFrame using
{{domxref("MessagePort.postMessage")}} along with a message. The
{{domxref("Window.postMessage()")}} along with a message. The
`handleMessage` handler then responds to a message being sent back from the
IFrame (using {{domxref("MessagePort.message_event", "onmessage")}}), putting it into a paragraph.
{{domxref("MessageChannel.port1", "port1")}} is listened to, to check when the message arrives.
Expand Down

0 comments on commit 5c5b3ab

Please sign in to comment.