Setting iFrame Height to Its Contents ...

I have an iFrame and I want it to expand / contract to fit its contents. The following code works on "some" of the loaded pages within the iframe, but on others it doesn't. I think the "Hgt2" below is what I need, that is the one that returns "null"; the other two return actual values.

I pulled some of this from Googling my issue, the statement below are the core of what I found to do but they don't work across the board.

What I need, I think, is the body height of the page that is being loaded into the iframe, but how do I get that value "consistently"??

If the page being loaded are from a different domain, then any reference to the window or document object of the loaded page will fail because cross-domain scripting is a security violation that is enforced in every modern browser.

Everything is within the same base domain, on our website. When I say base domain, I mean test.mydomain.com. But, it seems that the one page that returns values is a static page on the web server itself, whereas the other pages are "loaded" from our internal server, meaning the html page is not on the web server, it resides on our internal server. It is sort of like JAVA in that the JAVA code is not on the web server, it's on a server that is called.

Would that matter? It seems coincidental, maybe I should test that some.

Featured Post

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…

In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property
Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…