daattali / shinydisconnect

🔌 Show a nice message when a Shiny app disconnects or errors

Home Page:https://daattali.com/shiny/shinydisconnect-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enhancement - link to website

mattapel opened this issue · comments

Hi there,
thanks for this great package!
I tried to use your code in app on shiny server open source to route users back to a log in website.
Therefore I adjusted your utils.R, simply trying to add a link.
Strangely, it still only reloads, even if I remove "onclick="window.location.reload(true);" replace with onclick="window.location='https://www....';" or just add a link to href.
Is this somehow hardcoded on the side of shiny server ?

That should work. I just tried it, I changed this line

htmltools::tags$a(id="ss-reload-link", href="#", onclick="window.location.reload(true);")

to

htmltools::tags$a(id="ss-reload-link", href="#", onclick="window.location='https://github.com/daattali/shinydisconnect/issues/12';")

And then ran the example app:

  shinyApp(
    ui = fluidPage(
      disconnectMessage(),
      actionButton("disconnect", "Disconnect the app")
    ),
    server = function(input, output, session) {
      observeEvent(input$disconnect, {
        session$close()
      })
    }
  )

And when the app gets disconnected and I click the Refresh button, it goes to the new URL.