# After IP change (via dashboard), how can I redirect dashboard to new URL?

**URL:** <https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382>\
**Category:** Dashboard\
**Created:** [9 May 2020 13:58 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382 "2020-05-09T13:58:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tods09](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@Tods09](https://discourse.nodered.org/u/Tods09)\
**Post date:** [9 May 2020 13:58 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/1 "2020-05-09T13:58:04Z")

</div>

Hello.

Does anybody know a node which can take as a input a msg.payload (from a text input node) and open a New web Page with The format adress [http://msg.payload](http://msg.payload)?

Thank you!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 May 2020 14:12 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/2 "2020-05-09T14:12:15Z")

</div>

I'm sure you could create a template node that could do something like that - but node of the default nodes will (or should) s it is a massive security hole to do that without input validation and sanitisation.

---

<div class="post-metadata">

**Author:** ![Tods09](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@Tods09](https://discourse.nodered.org/u/Tods09)\
**Post date:** [9 May 2020 14:21 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/3 "2020-05-09T14:21:38Z")

</div>

Thank you mister.

I tried to use a template node but I don't know exactly how to write the code to implement msg.payload within.

Using href, I only can put a fixed adress web. I need to do somehow to acces The msg.payload within href,which comes as an input from a text input node.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 May 2020 16:04 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/4 "2020-05-09T16:04:26Z")

</div>

So you want to open a new web page from text entered into a text input?

Well the text input is a dashboard node and the user could just type into the address bar of the browser - so what's the difference?

You realise the text input is rendered client side (in the browser) and each character you type is sent to server side (node-red server) - how do you then expect that payload to come back to the client side (browser) and open a web page?

Please explain your exact requirement

Also, please stick to one thread.

---

<div class="post-metadata">

**Author:** ![Tods09](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@Tods09](https://discourse.nodered.org/u/Tods09)\
**Post date:** [9 May 2020 16:17 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/5 "2020-05-09T16:17:39Z")

</div>

Okay, I Will stay on this thread. This is my requirement:

I am currently running node Red with a raspberry pi, and for my Project i need to connect with pi through eth LAN IP remotely (I am doing this writing in the browser adress bar The IP of Raspberry, something like http:// 192.xxx.xx.x/ui for having acces to the dashboard) I want to have the possibility to change eth IP from raspberry pi, and for that I made a input text where I introduce my New IP and after I press a button (name Saved) I am Will execute a script(with exec node) to change my raspberry IP. But, after I change my LAN eth IP, The problem is I Will imediately lose my connection with pi, because obviously in the browser link I need to introduce the new LAN IP to connect again to my PI.

That being said, can anyone give me an idea how could I make after I press a button to open a new web Page adress which will include my New IP? Do you know about a node which after receive a msg.payload( equal with my New IP) can open a New web Page where msg.payload is include în adress?

Let's say input text IT Will give me a msg.payload='192. Xxx. X. X' as a string. This value i need to get through a node as a input and that node need to open [http://192.Xxx.X.X/ui](http://192.xxx.x.x/ui).

I was trying with Java function node but it gives me an error. Also with ui\_template but in the Code for IT I don't really know how to include The msg.payload.

Thank you!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 May 2020 16:29 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/6 "2020-05-09T16:29:02Z")

</div>

> [@Tods09](#):
>
> I was trying with Java function node but it gives me an error. Also with ui\_template but in the Code for IT I don't really know how to include The msg.payload.

Its JavaScript not Java (big difference).

Have you read the built in help for ui\_template? It has an example of getting payload from node-red to client side. Try adapting that.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 May 2020 16:55 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/7 "2020-05-09T16:55:16Z")

</div>

> [@Tods09](#):
>
> Let's say input text IT Will give me a msg.payload='192. Xxx. X. X' as a string. This value i need to get through a node as a input and that node need to open [http://192.Xxx.X.X/ui](http://192.xxx.x.x/ui).

There is a conundrum here...

- If the IP change is successful, you will lose connection (so you won't get a msg.payload)

Off the top of my head....

- In a ui\_template, have a button that does the following (all client side script in the ui\_template)
  - send a payload with new IP to the node-red.
  - set a timeout (`setTimeout`) of 60sec that redirects to the new address
  - Setup a `<a>` link pointing to the new page (so user can manually click instead of waiting 60sec)

- In node-red
  - setup an inject to send a topic "ping" 40sec after the change IP command occurs - if the dashboard receives this msg, then the IP change failed - clear the timeout. If it doesn't receive the "ping" msg, then it (probably) worked and the 60 sec timeout will happen and the page redirects to the new address.

Its a cludge but should work.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 June 2020 16:55 UTC](https://discourse.nodered.org/t/after-ip-change-via-dashboard-how-can-i-redirect-dashboard-to-new-url/26382/8 "2020-06-08T16:55:22Z")

</div>

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