# ui\_iFrame disable if flow context contains exact value

**URL:** https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533
**Category:** Dashboard
**Created:** [20 February 2025 12:27 UTC](https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533 "2025-02-20T12:27:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![P.Macak](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@P.Macak](https://discourse.nodered.org/u/P.Macak)
#### Post date: [20 February 2025 12:27 UTC](https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533/1 "2025-02-20T12:27:24Z")

</div>

Hello colleagues,

I'm trying to build some kind of switch which will enable specific ui\_iFrame based on value in flow context. For example if (flow.get('agv\_status') === "offline") --\> disable ui\_iFrame 1-3 and enable number 4.

I would appreciate your ideas how to do it.

Thank you.

---

<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: [20 February 2025 12:59 UTC](https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533/2 "2025-02-20T12:59:44Z")

</div>

You can define the iFrame directly in a `template` node, e.g.

```auto
<iframe id="iFrame-1" src="http://example.com" width="600" height="400" frameborder="0" title="Example iframe"></iframe>

```

Then in your implementation, get the iFrame object and manipulate it as you please:

```auto
const iframe1 = document.getElementById('iFrame-1');
// Now do what you want with the iFrame

```

Note, that if you take the status from a flow context var, this var is defined in the server, whereas the iFrame is a client object. You will need to send a message with the desired iFrame statuses to the client

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [20 February 2025 13:18 UTC](https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533/3 "2025-02-20T13:18:57Z")

</div>

Using flow context you will have to poll that in a flow and send a message to the template. It is generally preferable just to send the message to the template at the time you set the flow context, so you don't need to poll it.

---

<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: [22 March 2025 13:19 UTC](https://discourse.nodered.org/t/ui-iframe-disable-if-flow-context-contains-exact-value/95533/4 "2025-03-22T13:19:55Z")

</div>

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