Prachi
Prachi

Reputation: 570

Event triggered when Window.postMessage() is fired

I've been reading up on using Window.postMessage() for cross-origin communication. From what I understand, when we fire the postMessage call to the other source from our window, we need to listen for response using the 'message' event handler. i.e. the other source fires the message event. But is there any specific event that gets fired when we call Window.postMessage() ?

Upvotes: 0

Views: 1164

Answers (1)

Samer
Samer

Reputation: 988

The postMessage sends a message across to the other window, it doesn't dispatch an event from the origin, it's just the traget that dispatches the message event when it gets a message.

Upvotes: 1

Related Questions