FlowFuse / node-red-dashboard-2-ui-iframe

A Node-RED Dashboard 2.0 widget that allows you to embed an iframe into your dashboard
Apache License 2.0
1 stars 0 forks source link

Allow messaging to & from the iFrame's internal window #13

Open omrid01 opened 1 month ago

omrid01 commented 1 month ago

Description

I the predecessor (Dashboard 1.0) iFrame node, when sending msg.payload to the node it would stringify & post it to the internal window. for example, when playing a YouTube video in the iFrame, you could control it with messages such as:

msg.payload = {
   event: "command",
   func: "pauseVideo",
   args: []
}

This was done as follows: iframe.contentWindow.postMessage(JSON.stringify(msg.payload), origin);

It would be good to have this functionality here too. Also, would be good to add listener and an output port and, and support receiving messages from the iFrame's internal window,

Have you provided an initial effort estimate for this issue?

I can not provide an initial effort estimate