I\'m trying to make my Shiny app to redirect the user to another page. I\'m using httr
to send GET
requests and see if the user is logged in. If he\'s
Here this will navigate you to google if not true
library(shiny)
jscode <- "Shiny.addCustomMessageHandler('mymessage', function(message) {window.location = 'http://www.google.com';});"
ui <- fluidPage(
tags$head(tags$script(jscode)),
checkboxInput("Redirect","Redirect",value = T)
)
server <- function(input, output, session) {
observeEvent(input$Redirect,{
if(!input$Redirect){
session$sendCustomMessage("mymessage", "mymessage")
}
})
}
shinyApp(ui,server)