0

First of all
I have no interest in resizing the iframe.


I'm trying to make the Website inside an iframe to alert its document height.

Simply I have this pages:

www.PARENT.com

<body>
  <iframe src="http://www.CHILD.com" />
</body>

www.CHILD.com
- index.html
- contactus.html

  <!-- ** FOOTER SCRIPT ** -->
  <script>
    var body = document.body,
        html = document.documentElement;

    var height = Math.max( body.scrollHeight, body.offsetHeight, 
                           html.clientHeight, html.scrollHeight, html.offsetHeight );

    alert( height ); //NOW TELLING MY HEIGHT!
  </script>

As mentioned above, in www.CHILD.com, there are a few pages with different heights, like:

  • www.CHILD.com/index.html -- 450px
  • www.CHILD.com/contactus.html -- 1000px

And I'm using the script above at footer section of both pages.

But then whenever I run the www.PARENT.com page, I always get:

Alert:

450

What is the problem here?

Ferdinand.kraft
  • 12,579
  • 10
  • 47
  • 69
シリウス
  • 1,931
  • 3
  • 14
  • 8
  • 1
    possible duplicate of [Resizing an iframe based on content](http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content) – DevlshOne Aug 22 '13 at 11:13
  • Who said i want to RESIZE the IFRAME??? (Totally NOT interested in your thing to buy!) Just asking how to make IFRAME to ALERT its current height. – シリウス Aug 22 '13 at 11:44

0 Answers0