Intermittent document.body is null error in _fnBrowserDetect() function

Intermittent document.body is null error in _fnBrowserDetect() function

msmolyakmsmolyak Posts: 2Questions: 1Answers: 0

The DataTables 1.9.4 table frequently fails to load in my application with an error

TypeError: document.body is null

on line 4934 on the unminified JS file. This is the line

document.body.appendChild(n)

in _fnBrowserDetect() function.

The error only happens on specific machines - I could not replicate it in my environment although I am using the same version of the browser as the users (Firefox 17.0.5). It only happens occasionally, probably 1 out of 3 times the page with the table loads.

What might cause this error?

Thank you,

Michael

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    I've not come across this before, but might the table be getting initialised before the DOM is ready?

    Allan

  • msmolyakmsmolyak Posts: 2Questions: 1Answers: 0

    I suspect this might be the case. I am looking at adding RequireJS DomReady plugin to avoid such a possibility.

    Thank you for your reply.

    Michael

This discussion has been closed.