0

I am ideally trying to embed a website in my shiny app code, so that when users click "Cell Culture" under "Item 1", the google homepage shows up. I tried doing this, but my code does not work. Ideally, when the user clicks "Cell Culture" under "Item 1", Google's homepage should automatically show in the dashboard, however, if this is not possible and the user has to click a hyperlink to access google's homepage, that is fine too.

here is my code so far:

    library(shiny)
library(shinydashboard)


ui <- dashboardPage(
    dashboardHeader(title = "Dashboard"),
    dashboardSidebar(
      sidebarMenu(
        menuItem("Item 1", tabName = "Item 1", icon = icon("medicine"),
          menuSubItem("Cell Culture",
                      list(ui = fluidPage(
                        uiOutput("tab")))),
          menuSubItem("Isolation"),
          menuSubItem("Drug Substance"),
          menuSubItem("Drug Product")),
        menuItem("Item 2", tabName = "Item 2", icon = icon("medicine"),
                 menuSubItem("Cell Culture"),
                 menuSubItem("Isolation"),
                 menuSubItem("Drug Substance"),
                 menuSubItem("Drug Product"))
      )
    ),
    dashboardBody())

server = function(input, output, session){
  url <- a("Google Homepage", href="https://www.google.com/")
  output$tab <- renderUI({
    tagList("URL link:", url)
  })
}

shinyApp(ui, server)
  • Where is the web page meant to appear in the app? – norie Jul 29 '21 at 16:10
  • After the user clicks Item 1, then Cell culture, the google home page should appear –  Jul 29 '21 at 16:11
  • 1
    Appear where? If you want Google home page to appear in your browser use the `href` property of the menu item. – norie Jul 29 '21 at 16:12
  • Tried that but could not get it to work. The homepage should appear in the body of the dashboard app –  Jul 29 '21 at 16:21
  • Nevermind, i got it, thanks! –  Jul 29 '21 at 16:25
  • Does this answer your question? [Create URL hyperlink in R Shiny?](https://stackoverflow.com/questions/42047422/create-url-hyperlink-in-r-shiny) – Dylan_Gomes Aug 16 '23 at 04:33

0 Answers0