My website is embedded on partner sites through an iframe, but the length of my new website exceeds the space allocated in the iframes set by my partners (who have disabled scrolling).
Since I am unable to adjust the settings on my partner sites, I need to modify my own site to ensure everything functions correctly. I have discovered that I can add
<div style='width:325px;height:400px;overflow:scroll'>
, as long as the dimensions match those of the parent iframe.
Is there a way for me to dynamically determine the width and height of the parent iframe so that I can apply it to my own site? Alternatively, can I use the viewport to gauge the size of the parent container?
<iframe srcdoc="
<html><body>
<div style='width:325px;height:400px;overflow:scroll'>
<h1>Hello,<b>world1</b>.</h1><br /><h1>Hello,<b>world2</b>.</h1><br /><h1>Hello,<b>world3</b>.</h1><br /><h1>Hello,<b>world4</b>.</h1><br /><h1>Hello,<b>world5</b>.</h1><br /><h1>Hello,<b>world6</b>.</h1><br /><h1>Hello,<b>world7</b>.</h1><br /><h1>Hello,<b>world8</b>.</h1><br />
</div></body></html>"
scrolling="no" width=325px height=400px>
</iframe>