Why is document.body == null in Firefox but not Safari

Posted by dlamblin on Stack Overflow See other posts from Stack Overflow or by dlamblin
Published on 2009-10-27T13:55:10Z Indexed on 2010/04/02 15:13 UTC
Read the original article Hit count: 367

I have a problem with a page where I am trying to get colorbox (a kind of lightbox for jQuery) working. It doesn't work apparently due to the document.body being null in FireFox (3.5.3). This is not the case in Safari (4.0.3) where the colorbox works.

Something that jumps out at me is that (I'm using Drupal 6) drupal has appended a script tag to set some JavaScript variables at the very bottom of the page, below the closing body and html tags. Otherwise I don't see a problem. Unfortunately I'm having a lot of trouble getting it not to do that. Could it be this that's causing FF to have issues with the body?

Using colorbox's example files in Firefox does work (and the document.body is defined there).

Is there any way I could use jQuery to refill the document.body property with something from $() perhaps, or should I keep banging at drupal to not put a script tag outside the html tags (easier said than done)?

To clarify the document.body is null even after the page is done loading. Here's a Firebug console capture:

>>> document.body
>>> $().attr('body')

© Stack Overflow or respective owner

Related posts about document-body

Related posts about firefox