NodeJS "window.open("URL")" alternative?

3,281 views
Skip to first unread message

Justin Roy

unread,
Dec 27, 2016, 6:15:59 PM12/27/16
to Node-RED
Hello everyone,

I was told this was the best resource for asking questions about NodeRed according to my co-workers.

Currently I am running some flows for analytic and graphing purposes and I was hoping to have a "Click for Support" button that routed to an external website (open tab/window or just change URL, not super picky) but through my research I am having issue finding the correct method because JavaScript is not my best language and NodeJS is even farther behind.

When attempting to the JavaScript function below (and in title) it errors that "Window." is not referenced which leads me to believe that not all libraries of JavaScript are included in Node default.

Is there any good alternative to "window.open("URL") or similar for changing current page or opening new tab/window to a specific web-page?

Thank you much.

Ben Hardill

unread,
Dec 27, 2016, 6:23:33 PM12/27/16
to Node-RED
Where have you put this call to `window.open()`?

A node's .js file is all executed on the server side so can not open any web pages on the client (browser) side.

Wesley Stam

unread,
Dec 28, 2016, 9:27:16 AM12/28/16
to Node-RED
Where would this 'Click for Support' button go?

Wesley Stam

unread,
Dec 28, 2016, 9:29:08 AM12/28/16
to Node-RED
If you want such button in the node-red (editor) itself then you would have to make a node-red module I guess;


On Wednesday, December 28, 2016 at 12:15:59 AM UTC+1, Justin Roy wrote:

Justin Roy

unread,
Dec 28, 2016, 10:15:25 AM12/28/16
to Node-RED
It would go on any of the UI pages as a UI Element leading to a Function node running onclick (in theory)

Justin Roy

unread,
Dec 28, 2016, 10:15:41 AM12/28/16
to Node-RED
Thank you for the information, this will help in the future.

Justin Roy

unread,
Dec 28, 2016, 10:17:11 AM12/28/16
to Node-RED
My intiial testing was using a UI button leading to a Function node that would be called onClick of the button.

Ben Hardill

unread,
Dec 28, 2016, 12:16:21 PM12/28/16
to Node-RED
The function node code executes on the backend side so this won't work.

Your best bet is use a template node and just include a link in the template to the site
Reply all
Reply to author
Forward
0 new messages