我有一个应用程序,类似这样:
library("shiny")
library("shinydashboard")
runApp(
list(
ui = shinyUI(
dashboardPage(skin = "black",
dashboardHeader(title = "dashboard",
tags$li(a(onclick = "setTimeout(function(){window.close();}, 100); ",
icon("power-off", "fa-2x"),
title = "Power off"),
class = "dropdown")),
dashboardSidebar(width='250px'),
dashboardBody()
)
),
server = shinyServer(function(input, output, session) {
session$onSessionEnded(function() {
stopApp()
})
})),
launch.browser = TRUE)
当我在浏览器中本地运行时关闭按钮工作,但不在内部Rstudio浏览器中。
当我部署它时,该按钮不起作用:
http://35.158.77.79/testclose/
最后,如果我在shinyapps.io部署它,关闭按钮就可以了!
任何人都知道问题是什么? JavaScript的?