Sending control messages in Dashboard 2.0 ui-iframe

I am using Dashboard-2.0 ui-iframe node, and able to set the url dynamically with msg.src.
In dashboard-1.0, the node-red-node-ui-iframe node was also able to send control messages to the iFrame. For example, controlling a YouTube video in runtime with commands such as:

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

I don't seem to find the equivalent in the Dash2 iframe node. Is it supported?

Not currently, wasn't aware that was a possibility. Not even sure I'd know how to support such a feature as it'd be entirely dependent on what the content in the iframe is? Would require some digging, and likely a low priority for me atm, but PRs are very welcome.

hmmm. This was implemented in one of the examples provided with the D1 node. Out of curiosity, I looked into the code and saw that it is sending msg.payload as a generic post message on the iFrame content window.

           if (iframe.contentWindow && msg.payload) {
                var data = JSON.stringify(msg.payload);
                iframe.contentWindow.postMessage(data, "${origin}");

Not in high priority, but could be nice to have.
In my case, I went ahead and implemented in a template node.

1 Like

Can you open this as an issue on Issues · FlowFuse/node-red-dashboard-2-ui-iframe · GitHub please?