Event rule based window message? | Community
Skip to main content
tim_funk
New Participant
May 28, 2021
Question

Event rule based window message?

  • May 28, 2021
  • 1 reply
  • 1290 views

Is there an event configuration where my rule would trigger on the equivalent of window.addEventListener("message" ...) ? Then even more vexxing is can I then create rule conditions filtering on the values in event.origin and event.data? Based on what I see - I think the answer is no.

 

Use case is I have an iframe using postMessage to let the parent window know something happened.

 

I suspect I will need to create my own listener. Then let that listener do the appropriate filtering and validation and then based on the payload fire the appropriate direct calls.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Andrey_Osadchuk
New Participant
May 29, 2021

You may want to use Custom Event to get the rule triggered.

 
tim_funk
tim_funkAuthor
New Participant
June 1, 2021
I don't think Custom Event will work. The event is fired onto the window object. And the custom event rule seems to be element focuses. But I do see "Custom Code" in which case I could add my window.addEventListener("message". function(){if(checkPasses) trigger()})