0

I want to open a confirmation dialog and after clicking the confirm-button I want to open a URL within the same window. It will be a deployed app and browseURL() is not an option.

So far I have this:

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  
  actionButton("open", "Click Me")
  
)

server <- function(input, output, session) {
  
  observeEvent(input$open, {
    confirmSweetAlert(
      session = session,
      inputId = "confirm",
      title = "Please confirm."
    )
  })
  
  observeEvent(input$confirm, {
    if (input$confirm) {
      browseURL('http://www.google.com')
    }
  })
  
}

shinyApp(ui, server)

Are there any alternatives to browseURL?

eastclintw00d
  • 2,250
  • 1
  • 9
  • 18
  • 1
    Does this answer your question? [Redirect in Shiny app](https://stackoverflow.com/questions/47157880/redirect-in-shiny-app) – landroni Aug 18 '21 at 17:37

1 Answers1

0

I found a solution.

This solves my problem and i can redirect to where I want.

eastclintw00d
  • 2,250
  • 1
  • 9
  • 18