Fariya
Fariya

Reputation: 284

how to open a link in shiny

With the help of this code i can open url in new tab instead of that how to open this url as a popup in the same window

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

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

Thanks in advance

Upvotes: 0

Views: 1583

Answers (2)

St&#233;phane Laurent
St&#233;phane Laurent

Reputation: 84529

Maybe:

onclick = 'window.open("http://google.com", "Google", "width=480,height=360,resizable=no,toolbar=no,menubar=no,location=no,status=no")'

Upvotes: 1

Pork Chop
Pork Chop

Reputation: 29387

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)

Upvotes: 2

Related Questions