I want to give iFrame 100% width and height according to its content but it is not taking 100% width nor 100% height.
I have tried to give by using position absolute but the iframe width increased more than the container where it lies.
Here is my code:
<iframe id="solar_panel" width="100%" height ="740" src="<?php echo $s; ?>"></iframe>
<script>
var intervalListener = self.setInterval(function () {resizeIframe()}, 1000);
function resizeIframe() {
var obj = document.getElementById('solar_panel');
var objH = obj.contentWindow.document.body.scrollHeight;
obj.style.height = obj.contentWindow.document.body.scrollHeight + "px";
if (objH != 0) {
window.clearInterval(intervalListener);
}
}
jQuery(window).resize(function(){
resizeIframe();
});
</script>
Please help me out of here.