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 comment:1
owner: | → jon@jondufresne.org |
---|---|
status: | new → pending |
Changed November 28, 2012 05:14PM UTC by comment:2
status: | pending → new |
---|
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 comment:3
status: | new → pending |
---|
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 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 comment:5
resolution: | → invalid |
---|---|
status: | pending → closed |
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 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 comment:7
resolution: | invalid |
---|---|
status: | closed → reopened |
Not sure why this was auto-closed, it should have noticed you were the OP.
Changed January 26, 2013 10:11PM UTC by comment:8
status: | reopened → open |
---|
Changed May 02, 2013 08:42PM UTC by comment:9
component: | unfiled → css |
---|---|
priority: | undecided → low |
Changed May 21, 2013 07:17AM UTC by comment:10
Test updated for 1.x-master: http://jsfiddle.net/GmKmt/8/
Changed October 21, 2014 12:02AM UTC by comment:11
resolution: | → migrated |
---|---|
status: | open → closed |
Migrated to https://github.com/jquery/jquery/issues/1739
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.