Christian
Christian

Reputation: 1041

R shiny - how to fill out the entire space of the browser window with an iframe

How can I fill out the entire length of the browser window? While width="100%" seems to work fine height="100%" seems to fill out a frame which is invisible to me.

library(shiny)

ui <- fillPage(
    htmlOutput("frame")
)

server <- function(input, output) {
  output$frame <- renderUI({
    tags$iframe(src="https://stackoverflow.com/", height="100%", width="100%")
  })
}

shinyApp(ui, server)

Upvotes: 4

Views: 1697

Answers (1)

Wilmar van Ommeren
Wilmar van Ommeren

Reputation: 7689

You can adapt the height of the iframe with the style argument. For some reaseon setting it to height:100% does not work, but setting it to height:100vh does (viewport height)

library(shiny)

ui <- fillPage(
  htmlOutput("frame")
)

server <- function(input, output) {
  output$frame <- renderUI({
    tags$iframe(src="https://stackoverflow.com/", style='width:100vw;height:100vh;')
  })
}

shinyApp(ui, server)

Upvotes: 8

Related Questions