0

I have to set the height of the iframe based on the html content height. I am not able to find the exact height of the html content. i tried

alert($(document).height());

it is giving me 6214 and $(windows).height() just gives the height of viewpoint. Some of my pages are very long with scroll bar and some page doesnot have scroll bar. I want to get the exact height of the pages with or without scrollers so that i can set to the iframe. Please help me in this issue .

Thanks

Owais Ahmed
  • 1,364
  • 1
  • 30
  • 62

2 Answers2

0

$(document).height() will return you the exact height of your document i.e. your page.

If you want to get the content height use $(body).height().

snaren
  • 46
  • 3
0

try using offsetHeight

iframe.height = (iframe.contentWindow.document.body.offsetHeight) + "px";
Rajan Goswami
  • 769
  • 1
  • 5
  • 17