Shiny: Open New Browser Tab from Within Shiny App

What does it mean when R Shiny app downloadHandler only opens a new tab with new instance of app, no download?

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)

Shiny App name in browser tab not correct

As per the titlePanel function for windowTitle it simply gets h2 of the whatever it is you have your title named: I suggest you simply add the name for that too:

PlayerFinishingOverview <- div("Player Finishing Overview", style = "color:#D81B60")
PlayerFinishingOverviewWindow <- "Player Finishing Overview"


titlePanel(PlayerFinishingOverview,windowTitle = PlayerFinishingOverviewWindow)

link to open a new tab gets invisible in dashboard in r shiny app

The problem is your color:red doesn't get applied to your anchor a tag!

Modified Code:

library(shinydashboard)

dashboardPage(
dashboardHeader(title = "flex_logo",
tags$li(class = "dropdown",
tags$a("Help",target="_blank",href="Flex-Forecasting_Usage_Guidelines.pdf",
style="font-weight: bold;color:red;"))
),
dashboardSidebar(
radioButtons("filetype", "Select file type",choices=c("csv file","xlsx file"))
),
dashboardBody()
)

Shiny app - after clicking on new tab, the tab remains selected by browser

You can remove the dotted lines after tab selection by adding some CSS:

library(shiny)
runApp(list(ui = fluidPage(
titlePanel("Tabsets"),
sidebarLayout(
sidebarPanel(
radioButtons("dist", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp")),
br(),
sliderInput("n",
"Number of observations:", value = 500,
min = 1, max = 1000)
),
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table"))
)
)
)
, tags$head(tags$style(
HTML(
".nav-tabs > .active > a, .nav-tabs > .active > a:hover { outline: 0;}")
))
)
, server = function(input, output) {
data <- reactive({
dist <- switch(input$dist, norm = rnorm, unif = runif,
lnorm = rlnorm, exp = rexp, rnorm)
dist(input$n)
})
output$plot <- renderPlot({
dist <- input$dist
n <- input$n
hist(data(), main=paste('r', dist, '(', n, ')', sep=''))
})
output$summary <- renderPrint({summary(data())})
output$table <- renderTable({data.frame(x=data())})
})
)

So here

tags$head(tags$style(
HTML(
".nav-tabs > .active > a, .nav-tabs > .active > a:hover { outline: 0;}")
))

sets the outline attribute to 0 on the relevant quantities.

Sample Image

how to open a link in shiny

I guess you just wanted a resizable browser tab popup, for this you edit the JS and add resizable argument:

library(shiny)
ui <- fluidPage(shiny::fluidRow(shiny::actionButton(inputId='ab1',
label="click here", value = "Open popup",onclick ="window.open('http://google.com','_blank','resizable,height=260,width=370')")))

server <- function(input, output) {}
shinyApp(ui, server)


Related Topics



Leave a reply



Submit