# Url redirect when clicking a button

**URL:** <https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347>\
**Category:** Dashboard\
**Created:** [5 July 2018 10:02 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347 "2018-07-05T10:02:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zas97](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zas97/32/1012_2.png) [@zas97](https://discourse.nodered.org/u/zas97)\
**Post date:** [5 July 2018 10:02 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/1 "2018-07-05T10:02:02Z")

</div>

Hi,

I want to create a button in the dashboard that when the user clicks it he is redirected in the browser to the webpage [http://127.0.0.1:1880/configCamera](http://127.0.0.1:1880/configCamera). I also want to be able to append to this url something like “?name=‘name’”, where ‘name’ can be modified.

So far I tried to use http request, but I just get the response in a json.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [5 July 2018 10:13 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/2 "2018-07-05T10:13:12Z")

</div>

Why not use a ui-template node and add in your own button?

---

<div class="post-metadata">

**Author:** ![zas97](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zas97/32/1012_2.png) [@zas97](https://discourse.nodered.org/u/zas97)\
**Post date:** [5 July 2018 10:13 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/3 "2018-07-05T10:13:26Z")

</div>

I found a solution, I just need to create a node dashboard template with the following code:

```auto
var redirect = function(){
window.location.href = "myurl";
}
<button onclick="redirect()">config</button>

```

[edited by @knolleary to properly format the code]

---

<div class="post-metadata">

**Author:** ![zas97](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zas97/32/1012_2.png) [@zas97](https://discourse.nodered.org/u/zas97)\
**Post date:** [5 July 2018 10:13 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/4 "2018-07-05T10:13:57Z")

</div>

I just discovered that (=

---

<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:44 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/6 "2020-05-09T14:44:59Z")

</div>

Can you share your node? I need The same, a node which take as an input a msg.payload and acces a web Page with The adress [http://msg.layload](http://msg.layload)

---

<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 15:59 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/7 "2020-05-09T15:59:24Z")

</div>

@Tods09you now have 3 threads with same question. I am closing this (almost) 2y old topic.

Also @zas97 has not been online since Nov 2018.

---

<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 15:59 UTC](https://discourse.nodered.org/t/url-redirect-when-clicking-a-button/1347/8 "2020-05-09T15:59:31Z")

</div>


