I'm trying to get the height of a page (which might be loaded in an iframe) that has absolutely positioned elements that extend below the normal bottom of the page. Here are the things I've tried:
document.body.scrollHeight
document.body.offsetHeight
document.documentElement.clientHeight
document.documentElement.scrollHeight
document.documentElement.offsetHeight
$(document.documentElement).height()
$("html").outerHeight()
$("body").outerHeight()
$(document.html).height()
None of these pay attention to the absolutely positioned elements. Another way to ask this question: How do I find the position of the element which is the "lowest" on the page (ie is farthest down a page)?
Sounds like this question is very related to this one: Get height of document content including absolute/fixed positioned elements
Here's the function I'm using. The major improvement is that it works for IE and chrome (whereas Alessandro's original works for firefox, but gives heights far too large for IE and chrome).
If this can give you some help:
also this command give me the same value:
I tryed with this script but it should be improved cause it gives different result with different browser.
I would like to suggest you a script that, considering if there is absolute element, find the height:
I cannot refine it because of the time but I think this can help you check also the jsfiddle
EDIT: This is the last code I made and seems to works, i tested it in differents browsers (chrome,ie,ff,opera,safari) but with just 2 divs (1 absolute e 1 not), by changing the heights and by playing with margin top/bottom and top/bottom. Please, check it and let me know:
JSFIDDLE