Skip to main content

Bug Tracker

Side navigation

#4343 closed bug (invalid)

Opened March 12, 2009 10:31PM UTC

Closed March 18, 2009 03:14AM UTC

Last modified March 14, 2012 01:51PM UTC

$(window).innerHeight throws error in FF3.0.7

Reported by: adam.straughan Owned by: brandon
Priority: major Milestone: 1.4
Component: dimensions Version: 1.3.2
Keywords: innerHeight Cc:
Blocked by: Blocking:

The following page works in IE 6 and Chrome but not Firefox

firebug shows the following error;

[Exception... "Could not convert JavaScript argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: :: anonymous :: line 808" data: no]

Line 808




<script type="text/javascript" src=""></script>



var calcSize = function(){


var h = $(window).innerHeight();









<div id='ok'>click - jQuery ok?</div>

<div id='content'>

<p>click to demo bug</p>

<p>ready -> testing === bad, ready -> ok === good</p>




Attachments (0)
Change History (5)

Changed March 14, 2009 01:40AM UTC by dmethvin comment:1

The error is on this line:

  var computedStyle = defaultView.getComputedStyle( elem, null );


and elem=
as well.

Changed March 18, 2009 03:14AM UTC by brandon comment:2

resolution: → invalid
status: newclosed

Only the height method operates on the window. $(window).height()

Changed March 18, 2009 10:42AM UTC by adam.straughan comment:3

It may make sense that $(window).innerHeight() is invalid but if you don't know that (doc don't say 'do not use window') you can, as I did, spent time chasing your tail. I spent time breaking down my code to the simplest example so that I could post this issue.

Can I propose either a documentation change, ideally with a reason why this is invalid or (and this is obviously more work) a better diagnostics message.

Changed March 18, 2009 03:13PM UTC by brandon comment:4

I went ahead and updated the docs to reflect that inner/outer methods only work on elements and to use width/height for document and window. As of right now there really isn't an inner/outer height of the window nor document. There is only the width/height. That is why using the inner/outer methods for window/document are invalid.

Sorry for the short explanation earlier. I understand the effort involved in debugging and posting a bug. Thanks for your effort and I hope this doesn't discourage you from doing so again in the future. :(

Changed March 26, 2009 12:06AM UTC by raf comment:5

It may be worth mentioning that $(window).height() and window.innerHeight don't return the same value in Firefox. $(window).height() should be a clone of window.innerHeight for all browsers except IE, as it is the most reliable way of measuring the height of the inside of the viewport. For IE, the document.documentElement (for standards mode) and document.body (quirms mode) route should be used.