I want to display html reports in my shiny app.
I am currently using htmlwidgets::HTML
and shiny::htmlOutput
. Loading the first html report works fine, but loading subsequent reports results in only partially rendered html reports (e.g., some interactive plots now shown).
Inspecting the browser console showed that the html is not rendering due to syntax errors, such as "Uncaught SyntaxEror: Identifier 'LinePlot' already been declared".
So, the javascript in the html reports is not working correctly since the scripts are trying to re-declare identifiers that already exist.
It appears that I need to isolate the html reports in iframes.
HOWEVER, it appears that shiny will not host the html reports even if stored in the shiny app's www directory.
I'm using:
ui <- fluidPage(
tags$iframe(
style = "height:600px; width:100%",
src = "report.html"
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
... which just generates "Not Found" in the iframe.
Even if I use simple html such as <p>hello world</p>
, the iframe just shows "Not Found" .
I can show png images in the iframe, so hosting in www/ works, but apparently not for html files.
Any suggestions?