Display HTML inside flow


#1

Hello,

I'm trying to preview/display html file, is there an option to display this within flow something like a preview or a popup window in which we can show the html file contents. Please help


#2

the node-red canvas isn’t a dashboard, so there isn’t anyway of doing that currently.


#3

Hi Vid,

Like @ukmoose already explained, the flow editor isn't a dashboard. So this kind of stuff isn't really encouraged. If you really need to show custom content, have a look at this link. Some remarks:

  • Also have a look at Nick's reply to that post: the used API is not public, so it might not work anymore in a future version!
  • The node-red-contrib-image-output node displays it's own SVG content inside the SVG of the flow editor. So if you need to display HTML, I assume you might need something this. But I haven't tried this and I have no experience with it ...

Bart


#4

My method is to create a simple custom HTTP in/out that injects the html.

http-in -> read-file -> template -> http-out

Then you have a simplistic web page previewer. Not hard to adjust things so that you can send the file name as a parameter (though be wary of security issues, don't try to expose this over the Internet!). Another parameter and simple flow would let you view the source rather than the preview.

Of course, you can configure Node-RED to serve everything from a folder statically as well so that's another option.