I have deployed an app in shinyapps.io and its working fine.
I am running the app for only 5 minutes, but when I checked the metrics it shows a run
I found this excellent code which does the job. Basically, you do like so:
library(shiny)
library(shinyjs)
jscode <- "shinyjs.closeWindow = function() { window.close(); }"
ui <- fluidPage(
useShinyjs(),
extendShinyjs(text = jscode, functions = c("closeWindow")),
actionButton("close", "Close window")
)
server <- function(input, output, session) {
observeEvent(input$close, {
js$closeWindow()
stopApp()
})
}
shinyApp(ui, server)
Note though that closing the browser window through JavaScript may be prohibited. But this is another discussion.