Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline JavaScript not working within dashboardBody() #364

Open
chuansunaacg opened this issue May 18, 2021 · 0 comments
Open

Inline JavaScript not working within dashboardBody() #364

chuansunaacg opened this issue May 18, 2021 · 0 comments

Comments

@chuansunaacg
Copy link

chuansunaacg commented May 18, 2021

Hi all,

I used the example to create a redirect page for my Shiny app. The code works under fluidpage(), but doesn't work for our app under dashboardBody(). I'm familiar with R but not Javascript, so couldn;t really figure out why.

Below is a minimal reproducible example (of Javascript not working within dashboardBody()): (test2.html can be any html, I just use some text)

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
tags$script("
$(function() {$(document).on('shiny:disconnected shiny:error', function(event) {
$('.container-fluid').load('./test.html');
}) });
"),
actionButton("disconnect", "Disconnect the app")
)
)
server <- function(input, output, session) {
observeEvent(input$disconnect, {
session$close()
})
}
shinyApp(ui, server)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant