# UI-Template URL Button With Changing URL

**URL:** <https://discourse.nodered.org/t/ui-template-url-button-with-changing-url/25602>\
**Category:** Dashboard\
**Created:** [27 April 2020 08:52 UTC](https://discourse.nodered.org/t/ui-template-url-button-with-changing-url/25602 "2020-04-27T08:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrainBomber100](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/brainbomber100/32/25400_2.png) [@BrainBomber100](https://discourse.nodered.org/u/BrainBomber100)\
**Post date:** [27 April 2020 08:52 UTC](https://discourse.nodered.org/t/ui-template-url-button-with-changing-url/25602/1 "2020-04-27T08:52:09Z")

</div>

I'm trying to create a button using the UI-Template node that will open a new window using Google's Query URL. However, the URL is constantly updating based on the global variables that are in my flows. Is there any way I can create a button on the dashboard that constantly adapts to the new URL?

Here's part of my flow:

```auto
[{"id":"f48f1a39.a3ea08","type":"inject","z":"463ea969.55fbc8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1860,"wires":[["bf212998.193f38"]]},{"id":"bf212998.193f38","type":"function","z":"463ea969.55fbc8","name":"URL Launcher","func":"var lat = global.get(\"latitude\");\nvar lon = global.get(\"longitude\");\n\nmsg.payload = \"https://www.google.com/maps/search/?api=1&query=\" + lat + \",\" + lon;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1820,"wires":[["3574826b.b4665e"]]},{"id":"3574826b.b4665e","type":"ui_template","z":"463ea969.55fbc8","group":"8bc5fb43.adc908","name":"","order":2,"width":0,"height":0,"format":"<script>\nvar lat = global.get(\"latitude\");\nvar lon = global.get(\"longitude\");\nString url = msg.payload;\nfunction yeet(){\nwindow.location.href = url;\n}\n</script>\n\n<button onclick=\"yeet()\">config</button>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":460,"y":1840,"wires":[["11de1efa.7bdcb1"]]},{"id":"8bc5fb43.adc908","type":"ui_group","z":"","name":"Activity Log","tab":"9cd1808f.a7259","disp":true,"width":"6","collapse":false},{"id":"9cd1808f.a7259","type":"ui_tab","z":"","name":"EARS","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

```

Also, if it's possible to configure the button so that it has the same color scheme as the dashboard buttons, can you show me how to do that as well?

---

<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:** [27 May 2020 08:52 UTC](https://discourse.nodered.org/t/ui-template-url-button-with-changing-url/25602/2 "2020-05-27T08:52:17Z")

</div>

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