# Kiosk mode exit when pressing menu

**URL:** <https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175>\
**Category:** General\
**Created:** [16 July 2020 07:04 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175 "2020-07-16T07:04:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Barry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/john_barry/32/28987_2.png) [@John\_Barry](https://discourse.nodered.org/u/John_Barry)\
**Post date:** [16 July 2020 07:04 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/1 "2020-07-16T07:04:45Z")

</div>

Hi,

I've managed to setup a kiosk mode that cycles between tabs but the only way to exit is to navigate to a ui button that disables the mode.  
Is it possible to retrieve data from the main menu button so when that's pressed it exits the mode?  
Or even have a menu button to turn it on and off?

```auto
[{"id":"10c7cf8.bbf1731","type":"ui_ui_control","z":"4949ffeb.a969c","name":"","x":800,"y":220,"wires":[[]]},{"id":"9c8cc7e6.318c18","type":"function","z":"4949ffeb.a969c","name":"Tab select","func":"let tabIndex = context.get(\"tabIndex\") || 0;\nlet tabs = [1,2,3,4]; \n \nfunction selectNextTab() \n{\n\n return tabs[tabIndex++] || (tabIndex=0, tabs[tabIndex++]); \n}\n\nmsg.payload = {\"tab\" : selectNextTab()};\ncontext.set(\"tabIndex\", tabIndex);\nreturn msg;\n","outputs":1,"noerr":0,"x":600,"y":220,"wires":[["162f93cc.732bcc","10c7cf8.bbf1731"]]},{"id":"162f93cc.732bcc","type":"debug","z":"4949ffeb.a969c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":810,"y":260,"wires":[]},{"id":"9e8fb4b5.1a19f8","type":"ui_switch","z":"4949ffeb.a969c","name":"","label":"kiosk mode","tooltip":"","group":"57b39d9b.54b5a4","order":0,"width":"6","height":"1","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":190,"y":220,"wires":[["23bb490e.ca2e56","ed07d21e.93adb"]]},{"id":"23bb490e.ca2e56","type":"trigger","z":"4949ffeb.a969c","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-10","extend":false,"units":"s","reset":"false","bytopic":"all","name":"","x":410,"y":220,"wires":[["9c8cc7e6.318c18"]]},{"id":"ed07d21e.93adb","type":"debug","z":"4949ffeb.a969c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":140,"wires":[]},{"id":"57b39d9b.54b5a4","type":"ui_group","z":"","name":"Curing bins 1","tab":"9e0c87f5.bcf8c8","order":1,"disp":false,"width":30,"collapse":false},{"id":"9e0c87f5.bcf8c8","type":"ui_tab","z":"","name":"Home","icon":"home","order":2,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [16 July 2020 08:41 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/2 "2020-07-16T08:41:12Z")

</div>

Just off the top of my head as I'm not at a computer.  
You could have a button labelled Halt/Continue on each page/tab that sets a global flow variable. This variable could be checked in your JavaScript to halt the script or allow it to continue.

Not that elegant, but I'm sure it would work.

---

<div class="post-metadata">

**Author:** ![John\_Barry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/john_barry/32/28987_2.png) [@John\_Barry](https://discourse.nodered.org/u/John_Barry)\
**Post date:** [16 July 2020 09:14 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/3 "2020-07-16T09:14:33Z")

</div>

Thanks for the reply  
The tabs i'm displaying are web servers from different devices in iframe such as PLC's, power monitors and Grafana so there isn't any space for a button. I also don't want to add a button to the menu bar because it looks untidy and i would rather add a logo and time there

 ![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d2637cb29e9eab08691d348445f0d5639e41c038.png)

---

<div class="post-metadata">

**Author:** ![John\_Barry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/john_barry/32/28987_2.png) [@John\_Barry](https://discourse.nodered.org/u/John_Barry)\
**Post date:** [16 July 2020 09:22 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/4 "2020-07-16T09:22:52Z")

</div>

Just saw your last comment about elegance that's exactly what i am aiming for! 🙂  
another option, maybe more complicated would be to set a timer so if the screen hasn't seen any user activity then automatically enter the mode. Basically a screensaver of the tabs.  
Either way i need a menu click or general mouse click as a bit in the flow to solve this

---

<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:** [16 July 2020 09:57 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/5 "2020-07-16T09:57:02Z")

</div>

the menu can only hold links to tabs or we links to other pages... I've not tried it - but you may be able to create an http endpoint in your flow that then fires the same as your original button, that you could then link to.

---

<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:** [14 September 2020 09:57 UTC](https://discourse.nodered.org/t/kiosk-mode-exit-when-pressing-menu/30175/6 "2020-09-14T09:57:09Z")

</div>

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