Skip to main content

Bug Tracker

Side navigation

#12974 closed bug (migrated)

Opened November 28, 2012 12:11AM UTC

Closed October 21, 2014 12:02AM UTC

$('html').outerHeight(true) returns inconsistent results across browsers

Reported by: jon@jondufresne.org Owned by: jon@jondufresne.org
Priority: low Milestone: None
Component: css Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:
Description

I am receiving inconsistent results between browsers when using $('html').outerHeight(true). My goal is to retrieve the actual rendered height of the document. I am avoiding $(document).height() because if the rendered height is smaller than the window height, the window height is returned. On firefox, $('html').outerHeight(true) works correctly, but on IE8 the window height is always returned. Observe using the example at:

http://jondufresne.org/test.html

If I run this in Firefox I see:

window:561
document:1044
html:1044
body:1028

Notice the html height matches the document height.

If I run this in IE8 I see:

window:806
document:1272
html:810
body:1256

Notice the height (approx) matches the window height and not the document height.

Attachments (0)
Change History (11)

Changed November 28, 2012 12:55AM UTC by mikesherov comment:1

owner: → jon@jondufresne.org
status: newpending

Thanks for contributing! What about just $('html').height()? Does that give consistent results? We don't really support $('html').height() currently considering the browsers don't give us useful info as you've discovered, but I'm just curious.

Changed November 28, 2012 05:14PM UTC by jon@jondufresne.org comment:2

status: pendingnew

In that case, what is the preferred way to retrieve the actual content height? $(document).height() works well when the content is larger than the window, but when the content is smaller than the window $(document).height() returns the window height. $('html').height() appears to be correct on Firefox, but not IE. Is there a better solution?

I have updated the test case to show height() as well as outerHeight(true). Same results. This is some console output from running the test case.

Firefox:

$(window).height()=561
$(document).height()=1044
$('html').outerHeight(true)=1044
$('html').height()=1044
$('body').outerHeight(true)=1028
$('body').height()=1012

IE8:

$(window).height()=622
$(document).height()=1310
$('html').outerHeight(true)=626
$('html').height()=626
$('body').outerHeight(true)=1294
$('body').height()=1278

Changed December 13, 2012 07:05AM UTC by mikesherov comment:3

status: newpending

Thanks again for contributing! Your test case is missing the opening html tag. Can you update it please, considering I can't edit it as you are hosting it on your own server instead of submitting a jsfiddle?

Changed December 13, 2012 05:42PM UTC by Jon Dufresne <jon@jondufresne.org> comment:4

I have fixed the mistake in the test case. The results are the same. I have uploaded the newest test case to the same location.

I also made an identical version using jsFiddle. This version also demostrates the same bug. See the fiddle version at http://jsfiddle.net/GmKmt/6/

Changed December 28, 2012 09:05AM UTC by trac-o-bot comment:5

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed December 31, 2012 04:49PM UTC by jdufresne comment:6

What information is requested that was not provided? This is still reproducible and all information requested was provided.

Changed December 31, 2012 06:11PM UTC by dmethvin comment:7

resolution: invalid
status: closedreopened

Not sure why this was auto-closed, it should have noticed you were the OP.

Changed January 26, 2013 10:11PM UTC by dmethvin comment:8

status: reopenedopen

Changed May 02, 2013 08:42PM UTC by timmywil comment:9

component: unfiledcss
priority: undecidedlow

Changed May 21, 2013 07:17AM UTC by m_gol comment:10

Test updated for 1.x-master: http://jsfiddle.net/GmKmt/8/

Changed October 21, 2014 12:02AM UTC by m_gol comment:11

resolution: → migrated
status: openclosed