Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

iframe

shiny

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)
like image 773
Christian Avatar asked Sep 05 '25 03:09

Christian


1 Answers

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)
like image 198
Wilmar van Ommeren Avatar answered Sep 09 '25 17:09

Wilmar van Ommeren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!