Document Height Of An IFrame
Here's the key to the cross-browser issue I just tackled: the actual height of the document in an IFrame.
I know, I know. First question you probably had is, "Why are you using an iframe?" It's a cheap and easy way of loading an entire document into what you've currently got going. In this case, it helped untangle an upload new / manage existing items interface easier to implement. I've got an interface where I'm dynamically loading a page into an iframe and then resizing it to fit the height of the loaded document. MSIE keeps the document in a different spot in the DOM so I had to hunt it out.
var getIFrameDocumentHeight = function(IFrame) {
var d = i.contentDocument; /* FF/Chrome (iframe.contentDocument) */
if (!d) {
if (!d) {
/* MSIE (iframe.contentWindow.document) */
var w = i.contentWindow;
if (!w) { return 0; }
d = w.document;
if (!d) { return 0; }
var w = i.contentWindow;
if (!w) { return 0; }
d = w.document;
if (!d) { return 0; }
}
return d.offsetHeight;
}return d.offsetHeight;
I know, I know. First question you probably had is, "Why are you using an iframe?" It's a cheap and easy way of loading an entire document into what you've currently got going. In this case, it helped untangle an upload new / manage existing items interface easier to implement. I've got an interface where I'm dynamically loading a page into an iframe and then resizing it to fit the height of the loaded document. MSIE keeps the document in a different spot in the DOM so I had to hunt it out.

This is what XMLHttpRequest and AJAX are for.
(Anonymous)
if(Math.abs(iframe_height - last_iframe_height) < 10) return; if(iframe_height) document.getElementById('board').height = iframe_height+35+'px'; last_iframe_height = iframe_height;I wrote that JS ages ago and I know it could be written MUCH more cleanly now in my wiser years. :)