# Sending control messages in Dashboard 2.0 ui-iframe

**URL:** <https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [30 September 2024 09:04 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070 "2024-09-30T09:04:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [30 September 2024 09:04 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070/1 "2024-09-30T09:04:06Z")

</div>

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:

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

```

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

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [30 September 2024 09:16 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070/2 "2024-09-30T09:16:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [30 September 2024 14:32 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070/3 "2024-09-30T14:32:52Z")

</div>

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.

```auto
           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.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [30 September 2024 17:15 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070/4 "2024-09-30T17:15:30Z")

</div>

Can you open this as an issue on [Issues · FlowFuse/node-red-dashboard-2-ui-iframe · GitHub](https://github.com/FlowFuse/node-red-dashboard-2-ui-iframe/issues) please?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 October 2024 17:15 UTC](https://discourse.nodered.org/t/sending-control-messages-in-dashboard-2-0-ui-iframe/92070/5 "2024-10-30T17:15:46Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
