New Window with msg.payload

This seems so easy but I have not been able to figure it out.

I want to open a new window showing my msg.payload. The msg.payload is XML data so formatting it would be nice.

One of two ways.

  1. I have a dropdown and when that changes open the new window with XML data
  2. Have a button, when it is clicked it opens a new window of XML data

What have you tried?

Are you trying to open a new browser window automatically when a message is sent? You need to remember that, while you are accessing the node-red admin ui probably in the same browser, the flow is not running in the browser (front-end), it is running on the server (back-end). Two completely different contexts.

So to affect the front-end (browser) from the back-end (server), you need firstly to have a front-end app and secondly for that app to receive a message from the back-end. This is what Dashboard does.

However, Dashboard has its own limitations. It is a Single-page App (SPA). so you can't really open a "new window". But what you can do is use the Dashboard control node to switch to a different tab - assuming you already have the dashboard loaded.

When I make a selection it queries a database and retrieves the XML data. I want to then open the file so a user can view it. This XML data is currently in my payload from the query.

A couple weeks ago I had the template open a new window using HTML and JavaScript but I switched how I was dealing with data at that time and did not save the template. I will continue to research how I opened a window. I was hoping someone did this already and I am just overlooking some obvious way to do it.

No, front-end JavaScript is undoubtedly the best way if you really want a new Window.