A less complicated answer is to use .contents() to access the iframe. It is interesting, however, that this returns a different value from what I get using the code in my original answer, because of the filling on the body, I believe.
$('iframe').contents().height() + 'is the height'
This is how I did it for cross-domain communication, so I'm afraid it might be unnecessarily complicated. First, I would put jQuery inside an iFrame document; this will consume more memory, but should not increase load time, since only the script needs to be loaded only once.
Use iFrame jQuery to measure the height of your iframe body as early as possible (onDOMReady), and then set the hash URL for that height. And in the parent document, add the onload to the iFrame tag, which will look at the iframe location and extract the desired value. Since onDOMReady will always occur before the document load event, you can be pretty sure that the value will be correctly transferred if the race condition does not complicate the situation.
In other words:
... in Help.php:
var getDocumentHeight = function() { if (location.hash === '') {
... and in the parent document:
var getIFrameHeight = function() { var iFrame = $('iframe')[0];
Andrew Oct 02 2018-10-10T00: 00Z
source share