# \*\*how to close node-red browser window by a button in dashboard\*\*

**URL:** <https://discourse.nodered.org/t/how-to-close-node-red-browser-window-by-a-button-in-dashboard/83699>\
**Category:** Dashboard\
**Created:** [13 December 2023 21:55 UTC](https://discourse.nodered.org/t/how-to-close-node-red-browser-window-by-a-button-in-dashboard/83699 "2023-12-13T21:55:36Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [16 December 2023 01:02 UTC](https://discourse.nodered.org/t/how-to-close-node-red-browser-window-by-a-button-in-dashboard/83699/8 "2023-12-16T01:02:32Z")

</div>

Try this ui\_template. _Use at your own risk._

```auto
[{"id":"911e3d0e.7d6e9","type":"ui_template","z":"9d1b14cfb6a1526e","group":"325714454937adc5","name":"Close Current Browser Window","order":2,"width":0,"height":0,"format":"<script>\nvar elem = document.documentElement;\n\nthis.scope.action = function closeWindowWithConfirmation() {\nif (confirm(\"Are you sure you want to close the window?\")) {\nwindow.close();\n}\n}\n\ndocument.getElementById(\"close-button\").onclick = closeWindowWithConfirmation;\n\n</script>\n<md-button ng-click=\"send({payload:action()})\">\n Close Window\n</md-button>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":530,"y":160,"wires":[[]]},{"id":"325714454937adc5","type":"ui_group","name":"DEMO","tab":"fb48ae21810a7ddc","order":2,"disp":false,"width":"25","collapse":false,"className":""},{"id":"fb48ae21810a7ddc","type":"ui_tab","name":"TEST","icon":"dashboard","order":7,"disabled":false,"hidden":false}]

```

Inspired by this earlier post...

> [@Sendkeys to enter fullscreen](https://discourse.nodered.org/t/sendkeys-to-enter-fullscreen/4642/8):
>
> I asked bard to help me and this is what it gave and i inserted this into a template node, and it works! [{"id":"911e3d0e.7d6e9","type":"ui\_template","z":"28a414e3a8847f5a","group":"5a956c96.cfca64","name":"","order":2,"width":0,"height":0,"format":"\<script\>\nvar elem = document.documentElement;\n// or overwrite value in your callback function ...\n\nthis.scope.action = function toggleFullscreen() {\n var element = document.body;\n if (document.fullscreenElement) {\n document.ex…

---

_[View the full topic](https://discourse.nodered.org/t/how-to-close-node-red-browser-window-by-a-button-in-dashboard/83699)._
