Hi,
You are not using <iframe>
properly.
An iframe is used to load an external html page. It loads the page identified by its src
attribute:
<iframe src="https://nodered.org"></iframe>
Any HTML you add inside the <iframe>
tag is only displayed if the browser does not support iframes. So your <script>
tag is ignored. The right approach would be to forget the <iframe>
tag and just put the script tag in the ui_template node.
However... that particular script doesn't like being embedded in the way angular does it - you get the following error in the console:
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
So... you can use the approach @ukmoose suggested; create an HTTP In flow that returns a complete page containing the script, and then add an iframe to embed the page generated by that flow:
This is the HTTP-Template flow:
[{"id":"b693c8bd.8fce58","type":"http in","z":"538e49f9.1c9f18","name":"","url":"/widget","method":"get","upload":false,"swaggerDoc":"","x":340,"y":340,"wires":[["725e4327.04fd8c"]]},{"id":"725e4327.04fd8c","type":"template","z":"538e49f9.1c9f18","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html><head></head><body><script type='text/javascript' src='https://darksky.net/widget/default/53.0758,8.8072/us12/de.js?width=100%&height=350&title=Bremen&textColor=333333&bgColor=FFFFFF&transparency=false&skyColor=undefined&fontFamily=Default&customFont=&units=us&htColor=333333<Color=333333&displaySum=yes&displayHeader=yes'></script></body></html>","output":"str","x":500,"y":340,"wires":[["52adc52d.6dabcc"]]},{"id":"52adc52d.6dabcc","type":"http response","z":"538e49f9.1c9f18","name":"","statusCode":"","headers":{},"x":630,"y":340,"wires":[]}]
Then a ui_template node with:
<iframe src="http://localhost:1880/widget"></iframe>
although you'll need to change localhost:1880 to the appropriate thing to access your node-red instance.