Login Register

dojo.addOnLoad

IE issue :: dojo.addOnLoad Vs window.onload

As per my requirement I need to use

window.onload (using for javascipt effects initialization on images) and

dojo.addOnLoad(using for rest of javascript functionality and for page load optimization)

The order of event firing (first dojo.addOnLoad, next window.onload) is working properly in all other borwsers except IE (both IE6 an IE7).

In IE order of event firing is behaving oddly, After I done deep testing, I observed that,

SOLVED: Fix for dojo.addOnLoad with IE (Dojo 1.1)

Hello,

I've recently bumped into a dojo.addOnLoad bug with IE6: It can execute the passed function even if document's readystate is currently "loading".

Here's a way to patch dojo.addOnLoad:

    //dojo.addOnLoad patch if IE
    if(dojo.isIE){
        //Saving a copy of the original function.
        var origAddOnLoad=dojo.addOnLoad;
        //Wrapping it.
        dojo.addOnLoad=function(){
            var args=arguments;
            if(document.readyState=="complete"){

Syndicate content