embed Website: from standard shiny to flexdashboard not reactive

Hello,
I am trying to make a shinyapp using flexdashboard that takes as input a string of text, and then it outputs a website using that input text. I have an example working in standard shiny:

library(shiny)

ui <- fluidPage(titlePanel("Testing"), 
                sidebarLayout(
                    sidebarPanel(
                        fluidRow(
                            column(9, selectInput("Color", label=h5("Choose a color"),choices=c('red', 'blue'))
                            ))),
                    mainPanel(fluidRow(
                        htmlOutput("frame")
                    )
                    )
                ))

server <- function(input, output) {
    observe({ 
        query <- input$Color
        test <<- paste0("https://en.wikipedia.org/wiki/",query)
    })
    output$frame <- renderUI({
        input$Color
        my_test <- tags$iframe(src=test, height=600, width=535, frameborder = "no")
        print(my_test)
        my_test
    })
}

shinyApp(ui, server)

I have not been able to get this to work using flexdasboard. Here is my failed attempt (trying to use two alternative ways to get the output)

---
title: "Testing Colors"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)

lookup <- structure(c("r", "b"), .Names = c("Red", "Blue"))

Column {.sidebar}
-----------------------------------------------------------------------

```{r}
selectInput('Color', label = 'Select a color', choices = lookup, selected = "r")


Column {data-width=600}
-----------------------------------------------------------------------

### Color Web Page

```{r}
observeEvent(input$Color,{
    output$url <-renderUI(a(href=paste0("https://en.wikipedia.org/wiki/", input$Color)))
  })


Column {data-width=400}
-----------------------------------------------------------------------

### Another webpage

```{r}
selectedColor<- reactive({ 
  color <- input$Color 
  }) 
webpage <- renderUI({ 
  include_url(paste0("https://www.wikipedia.org/",selectedColor))
  })
webpage

I would certainly appreciate any pointers.

Thanks!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.