This is probably no longer relevant to your problems, but considering I had spent quite some time to get the iframe for my shiny-app to resize correctly, I'm posting this answer for future reference.
My setup is the following:
I have a free
shinyapps.io account and wanted to have a nice URL (instead of the ugly
www.username.shinyapps.io/appname one) so I put up a website that basically just displays the shiny-app using an iframe. Thankfully, other people have been developing the necessary tools to do this (a big thanks to
David Bradshaw). Download iframe-resizer from his website!
First, you have to set up the website which will point to the shiny-app. For this I simply modified one of the templates provided by David to look like this, the relevant parts are highlighted:
<!DOCTYPE html>
<html>
<body>
<div style="margin:5px;">
<iframe id="nestedIFrame" src="
LINK TO YOUR APP" width="100%" frameBorder="0" scrolling="no"></iframe>
</div>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript"
src="./ie8.polyfils.min.js"></script>
<script type="text/javascript"
src="./iframeResizer.min.js"></script>
<script type="text/javascript">
iFrameResize({heightCalculationMethod: "lowestElement"}); </script>
</body>
</html>
Make sure that all the necessary scripts (
ie8.polyfils.min.js, iframeResizer.min.js, downloaded from the iframe-resizer website ) are located within the same folder as the html-file, or to adjust the paths accordingly.
Next, you will have to include a line of code in your Shiny-app and create a folder "www". Create a folder called "www" in the main directory of your shiny-app (where app.R or your server.R and UI.R are located). Move the
iframeResizer.contentWindow.min.js script into that folder. Now, add the following line of code to the main Panel (or equivalent) of your app, like this:
mainPanel(
tags$body(tags$script(src="iframeResizer.contentWindow.min.js")),
...other stuff... )
And that's it. The iframe should automatically adjust its height to the size of the content inside the shiny-app, and the shiny-app will adjust to the width of the window.