One way to accomplish what you want is to edit the downloadButton function to create your desired effect:
# Below is the code for downloadButton
function (outputId, label = "Download", class = NULL, ...)
{
aTag <-
tags$a(
id = outputId,
class = paste("btn btn-default shiny-download-link",
class),
href = "",
target = "_blank", # This is the only part you'd need to change
download = NA,
icon("download"),
label,
...
)
}
# You can assign the above function to another object and edit the 'target' argument
downloadButtonEdit <- function (outputId, label = "Download", class = NULL, ...)
{
aTag <-
tags$a(
id = outputId,
class = paste("btn btn-default shiny-download-link",
class),
href = "",
target = NA, # NA here instead of _blank
download = NA,
icon("download"),
label,
...
)
}
Then just replace dowloadButton in your code with the downloadButtonEdit (or whatever you name it)