XF 2.0 Problem with Height 100% in iFrame

3rd AnGle

Well-known member
I have an embed file which, if set to width 100%, shrinks the file to much smaller size.

I researched and found out this from the community https://stackoverflow.com/questions/1966300/height-100-is-not-working-in-html-when-using-doctype

The problem could be that.. in the message block, 100% height is not referencing the embedded file height but the page HTML attributes. Stackoverflow suggest i use something like

<style>
html, body { height: 100% }
</style>

Width 100% works perfectly fine.... but it's the height.

Can you help... what i need to do?
 
Try this one:
Code:
<script language="javascript" type="text/javascript">
 function resizeIframe(obj) {
 obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
 }
</script>
<iframe src="your_url" width="100%" height="100%" frameborder="0" scrolling="no" onload="resizeIframe(this)" /></iframe>
 
Thank you @DohTheme and @BassMan for your help.

Bassman, i tried your code and it's still not working. The problem is the embed code is huge and it's like this


[PARSEHTML]<div class='tableauPlaceholder' id='viz1520069770078' style='position: relative'><noscript><a href='http://datasaurus-rex.com/datavisualization/game-of-thrones-interactive-viz-mkii'><img alt=' ' src='https://public.tableau.com/static/images/Ga/GameofThronesDeathsVizMkII/CharacterInfo/1_rss.png' style='border: none' /></a></noscript><object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> <param name='embed_code_version' value='3' /> <param name='site_root' value='' /><param name='name' value='GameofThronesDeathsVizMkII/CharacterInfo' /><param name='tabs' value='yes' /><param name='toolbar' value='yes' /><param name='static_image' value='https://public.tableau.com/static/images/Ga/GameofThronesDeathsVizMkII/CharacterInfo/1.png' /> <param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' /><param name='display_count' value='yes' /><param name='showTabs' value='y' /></object></div> <script type='text/javascript'> var divElement = document.getElementById('viz1520069770078'); var vizElement = divElement.getElementsByTagName('object')[0]; vizElement.style.width='100%';vizElement.style.height='750px'; var scriptElement = document.createElement('script'); scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js'; vizElement.parentNode.insertBefore(scriptElement, vizElement); </script>[/PARSEHTML]
 
Back
Top Bottom