Make tab link dynamic?

In the Layout section of my dashboard, I have added a link that opens in an iframe. Is it possible to make the link dynamic?

My idea has been to somehow use the ui_template node to embed a url in the header and then reference it in the 'Link' field. However, I do not know enough about HTML and Angular to do that.

It would be much easier if you create a new tab. On the tab just have a iframe node.

then just send the link in the url property.

eg use a function node or change node and set msg.url ="your link here" then pass to the iframe node

1 Like

I think that is what I am going to have to do - and its a fairly good idea as well.

Thank you for the response. I'll leave this open for another day or two and see if anyone has another idea.

Ok, I figured out how to do this with a pretty straightforward technique. (To be clear, the solution offered by @smcgann99 is a valid one. However, the issue with that is the iframe does not resize with your browser and is constrained to the widget. The ui_link solution is much more elegant in my opinion.)

What I ended up doing is redirecting urls using the Http in and out nodes to the urls that I want to be dynamic. For example, now if you enter in http://node-red-server:1880/ui/PiSugar, it will redirect you to the url of PiSugar. (I have to give credit to @knolleary from this Stackoverflow post on how to redirect urls using node-red).

Inside the function node, I am able to get my hostname variable and inject it into the Location property.

Lastly, for the ui_link node settings I have PiSugar for the link.

This produces a much more elegant iframe.

1 Like

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