body.addEventListener("load", init, false); However, if you want it to work on IE<9 as well you can use: var prefix = window.addEventListener ? "" addEventListener ('DOMContentLoaded', function (event) { //the event occurred }) for example if I’m adding the event listener inside a loop and I don’t really know what this will be when the event is triggered. Checking whether loading is already complete bug 99820 is about setting onload and onunload handlers using DOM Events syntax which is not the problem in this bug since he is setting the event handlers in the attribute defined onload handler init(). Powered by Discourse, best viewed with JavaScript enabled.