This simple example shows how you can have a button that, when clicked, will close the current browser tab and stop the running Shiny app (you can choose to do only one of these two actions).
This example makes use of the shinyjs package to call custom JavaScript functions.