Currently, I am attempting to determine the total height of a webpage's content, not just what is visible. In my efforts, I have managed to achieve some success in FireFox using:
document.getElementsByTagName('html')[0].offsetHeight
.
However, this method does not work in Internet Explorer and it also fails in Chrome when working with absolutely positioned elements (http://code.google.com/p/chromium/issues/detail?id=38999).
For anyone wanting to replicate this issue, below is a sample HTML file:
<html>
<head>
<style>
div {
border:solid 1px red;
height:2000px;
width:400px;
}
.broken {
position:absolute;
top:0;
left:0;
}
.fixed {
position:relative;
top:0;
left:0;
}
</style>
<script language='javascript'>
window.onload = function () {
document.getElementById('window.height').innerHTML = window.innerHeight;
document.getElementById('window.screen.height').innerHTML = window.screen.height;
document.getElementById('document.html.height').innerHTML = document.getElementsByTagName('html')[0].offsetHeight;
}
</script>
</head>
<body>
<div class='fixed'>
window.height: <span id='window.height'> </span> <br/>
window.screen.height: <span id='window.screen.height'></span> <br/>
document.html.height: <span id='document.html.height'></span> <br/>
</div>
</body>
</html>
Thank you for your assistance.
Sincerely, Guido Tapia