R闪亮-如何用iframe填充浏览器窗口的整个空间

Chr*_*ian 3 iframe r shiny

如何填满浏览器窗口的整个长度?虽然width="100%"看起来工作正常,height="100%"但似乎填充了一个我看不见的框架。

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)
Run Code Online (Sandbox Code Playgroud)

Wil*_*ren 7

您可以使用参数调整 iframe 的高度style。由于某种原因,将其设置为height:100%不起作用,但将其设置为 height:100vh(视口高度)

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)
Run Code Online (Sandbox Code Playgroud)