Hi community!
I am trying to embed a public Shiny app that is hosted on shinyapps.io as an iframe into a RMarkdown document with HTML output . I see some basic components of the Shinyapp in the iframe, but the CSS does not work and there is no functionality (first screenshot).
I tried two different ways to embed the app, both with the same result: First I tried to embed the app directly as an iframe, second I tried using knitr::include_app.
Both tests are included in this test .Rmd file:
(I replaced the R code chunk three ticks (```) with only one tick (`) to get the code to be displayed correctly here on the forum.)
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Test 1: Manual embedding with `iframe` tag
<iframe width="100%" height="150px" src="https://snsf-open.shinyapps.io/shiny_demoapp/" title="Shinyapps.io iframe demo"></iframe>
## Test 2: Automatic embedding with `knitr::include_app`
```{r test}
knitr::include_app(url = "https://snsf-open.shinyapps.io/shiny_demoapp/", height = "150px")
```
The the knitted .Rmd produced the following HTML, not showing any CSS or buttons of the Shinyapp:
When I add runtime: shiny in the YAML header, it does work. But I don't want to do this, as the output should be a standalone HTML file that can run on every webhost, not something I have to deploy on an RStudio Connect server.
I don't get why this simple embedding of an iframe does not work, especially as it works if I try if with an HTML file:
Test
```
This HTML displays correctly in a browser:
Thank you for any responses.