Reputation: 99
I have a Shiny app that includes multiple uses of downloadHandler() to trigger downloads of .csv, .rmd, and .zip files. It's supposed to just trigger download, but instead all of the downloadHandlers except for one just open a new browser tab with a new instance of the app running, except for one. That random one (formatted identically to the others) correctly triggers a download and no new tab opens.
Apart from the specific code that I'm using, what does it mean when downloadHandler() causes a new browser tab to open running a new instance of the app, with no download?
Thanks!
Upvotes: 1
Views: 701
Reputation: 3294
I was facing the same issue and found this solution which worked for me:
library(shiny)
ui = fluidPage(actionButton("Download", "Download"))
server = function(input, output) {
observe({
if (input$Download == TRUE){
filename= paste0(Sys.Date(), "_iris.csv")
write.csv(iris, filename)
}
})
}
shinyApp(ui = ui,
server = server)
Upvotes: 1